From d33e31d835b1e13f0b2fe97a777da965ee4c6893 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 18 Jul 2011 15:45:09 +0100 Subject: [PATCH] Don't check the blacklist if we've got nothing to check, stops stupid all blacklists errors --- app/hr/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/hr/utils.py b/app/hr/utils.py index 26d17f6..64f609c 100644 --- a/app/hr/utils.py +++ b/app/hr/utils.py @@ -44,13 +44,15 @@ def blacklist_values(user): # Check Character blacklists characters = evechars.values_list('name', flat=True) - objs = bl_items.filter(type=BLACKLIST_TYPE_CHARACTER, value__iregex=r'(' + '|'.join(characters) + ')') - blacklist.extend(objs) + if len(characters): + objs = bl_items.filter(type=BLACKLIST_TYPE_CHARACTER, value__iregex=r'(' + '|'.join(characters) + ')') + blacklist.extend(objs) # Check Corporation blacklists corporations = evechars.values_list('corporation__name', flat=True) - objs = bl_items.filter(type=BLACKLIST_TYPE_CORPORATION, value__iregex=r'(' + '|'.join(corporations) + ')') - blacklist.extend(objs) + if len(corporations): + objs = bl_items.filter(type=BLACKLIST_TYPE_CORPORATION, value__iregex=r'(' + '|'.join(corporations) + ')') + blacklist.extend(objs) # Check Alliance blacklists alliances = [x for x in evechars.values_list('corporation__alliance__name', flat=True) if x]