From 2f4ba7ab7640d0afa405cfa974688da1b4b077df Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 28 Sep 2011 10:57:08 +0100 Subject: [PATCH] Cleanup the char import, avoid hitting the API with corp keys --- app/eve_api/tasks/character.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/eve_api/tasks/character.py b/app/eve_api/tasks/character.py index 38a33f6..7127b31 100644 --- a/app/eve_api/tasks/character.py +++ b/app/eve_api/tasks/character.py @@ -117,12 +117,20 @@ def import_eve_character_func(character_id, key_id=None, logger=logging.getLogge else: acc = None - # Actual Key? Get further information + + # If we have a key, check if we should import the charsheet if acc: + if gargoyle.is_active('eve-cak'): + if (acc.is_cak and acc.has_access(3) and not acc.api_keytype == API_KEYTYPE_CORPORATION) or not acc.is_cak: + process_charsheet = True + else: + process_charsheet = False + else: + process_charsheet = True + + # Actual Key? Get further information + if acc and process_charsheet: if gargoyle.is_active('eve-cak') and acc.is_cak: - if not acc.has_access(3): - logger.error('Key %s does not have access to CharacterSheet' % acc.pk) - return auth_params = {'keyid': acc.api_user_id, 'vcode': acc.api_key, 'characterid': character_id } else: auth_params = {'userID': acc.api_user_id, 'apiKey': acc.api_key, 'characterID': character_id }