From f3feeaf4b355d6558c872e4519103e41b1a979d5 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 5 Jan 2011 07:14:43 +0000 Subject: [PATCH] Allow for new API keys to work properly --- eve_api/tasks/account.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eve_api/tasks/account.py b/eve_api/tasks/account.py index 4ca4be8..d76b909 100644 --- a/eve_api/tasks/account.py +++ b/eve_api/tasks/account.py @@ -109,11 +109,13 @@ def import_apikey_func(api_userid, api_key, user=None, force_cache=False): # Process the account's character list charlist = set(account.characters.all().values_list('id', flat=True)) + newcharlist = set([]) for char in doc['result']['characters']: import_eve_character.delay(char['characterID'], api_key, api_userid, callback=link_char_to_account.subtask(account=account.id)) - charlist.remove(int(char['characterID'])) - remchars = account.characters.filter(id__in=charlist) - for char in remchars: + newcharlist.append(int(char['characterID'])) + + toremove = charlist - newcharlist + for char in account.characters.filter(id__in=toremove): account.characters.remove(char) return account