Only check old keytypes if we don't have it already

This commit is contained in:
2011-09-28 10:20:07 +01:00
parent fd264a044a
commit aa2c153db5

View File

@@ -167,14 +167,15 @@ def import_apikey_func(api_userid, api_key, user=None, force_cache=False, log=lo
account.api_key = api_key account.api_key = api_key
account.api_status = API_STATUS_OK account.api_status = API_STATUS_OK
keycheck = CachedDocument.objects.api_query('/account/AccountStatus.xml.aspx', params=auth_params, no_cache=True) if not account.api_keytype or account.api_keytype == API_KEYTYPE_UNKNOWN:
keydoc = basic_xml_parse_doc(keycheck)['eveapi'] keycheck = CachedDocument.objects.api_query('/account/AccountStatus.xml.aspx', params=auth_params, no_cache=True)
if 'error' in keydoc: keydoc = basic_xml_parse_doc(keycheck)['eveapi']
account.api_keytype = API_KEYTYPE_LIMITED if 'error' in keydoc:
elif not 'error' in keydoc: account.api_keytype = API_KEYTYPE_LIMITED
account.api_keytype = API_KEYTYPE_FULL elif not 'error' in keydoc:
else: account.api_keytype = API_KEYTYPE_FULL
account.api_keytype = API_KEYTYPE_UNKNOWN else:
account.api_keytype = API_KEYTYPE_UNKNOWN
# Remove deleted or traded characters # Remove deleted or traded characters
newcharlist = [int(char['characterID']) for char in doc['result']['characters']] newcharlist = [int(char['characterID']) for char in doc['result']['characters']]