From 36566588e9ea1acf1e11e06ef32e90e10901d13d Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 25 Jul 2011 22:31:35 +0100 Subject: [PATCH] Change regex matching to exact --- app/hr/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/hr/utils.py b/app/hr/utils.py index 59ab461..e19ef8c 100644 --- a/app/hr/utils.py +++ b/app/hr/utils.py @@ -47,19 +47,19 @@ def blacklist_values(user): # Check Character blacklists characters = [re.escape(x) for x in evechars.values_list('name', flat=True) if x] if len(characters): - objs = bl_items.filter(type=BLACKLIST_TYPE_CHARACTER, value__iregex=r'(' + '|'.join(characters) + ')') + objs = bl_items.filter(type=BLACKLIST_TYPE_CHARACTER, value__iregex=r'^(' + '|'.join(characters) + ')$') blacklist.extend(objs) # Check Corporation blacklists corporations = [re.escape(x) for x in evechars.values_list('corporation__name', flat=True) if x] if len(corporations): - objs = bl_items.filter(type=BLACKLIST_TYPE_CORPORATION, value__iregex=r'(' + '|'.join(corporations) + ')') + objs = bl_items.filter(type=BLACKLIST_TYPE_CORPORATION, value__iregex=r'^(' + '|'.join(corporations) + ')$') blacklist.extend(objs) # Check Alliance blacklists alliances = [re.escape(x) for x in evechars.values_list('corporation__alliance__name', flat=True) if x] if len(alliances): - objs = bl_items.filter(type=BLACKLIST_TYPE_ALLIANCE, value__iregex=r'(' + '|'.join([x for x in alliances if x]) + ')') + objs = bl_items.filter(type=BLACKLIST_TYPE_ALLIANCE, value__iregex=r'^(' + '|'.join([x for x in alliances if x]) + ')$') blacklist.extend(objs) # Check API Key blacklists