If we don't have any alliances, dont run the query

This commit is contained in:
2011-07-09 11:17:00 +01:00
parent 2b3db4b383
commit d25a0ebd47

View File

@@ -53,9 +53,10 @@ def blacklist_values(user):
blacklist.extend(objs) blacklist.extend(objs)
# Check Alliance blacklists # Check Alliance blacklists
alliances = evechars.values_list('corporation__alliance__name', flat=True) alliances = [x for x in evechars.values_list('corporation__alliance__name', flat=True) if x]
objs = bl_items.filter(type=BLACKLIST_TYPE_ALLIANCE, value__iregex=r'(' + '|'.join([x for x in alliances if x]) + ')') if len(alliances):
blacklist.extend(objs) 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 # Check API Key blacklists
keys = user.eveaccount_set.all().values_list('api_user_id', flat=True) keys = user.eveaccount_set.all().values_list('api_user_id', flat=True)