mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Avoid hitting the API for NPC characters
This commit is contained in:
@@ -63,6 +63,10 @@ def import_eve_characters(character_list, key_id=None, callback=None, **kwargs):
|
||||
|
||||
def import_eve_character_func(character_id, key_id=None, logger=logging.getLogger(__name__)):
|
||||
|
||||
if int(character_id) >= 3000000 and int(character_id) < 4000000:
|
||||
# NPC character
|
||||
return EVEPlayerCharacter.objects.get_or_create(pk=character_id)
|
||||
|
||||
try:
|
||||
char_doc = CachedDocument.objects.api_query('/eve/CharacterInfo.xml.aspx', params={'characterID': character_id}, no_cache=False)
|
||||
except DocumentRetrievalError, exc:
|
||||
|
||||
@@ -117,6 +117,11 @@ def link_ceo(corporation, character):
|
||||
char = EVEPlayerCharacter.objects.get(id=character)
|
||||
corp.update(ceo_character=char)
|
||||
|
||||
# Fix the reverse link if needed
|
||||
if char.corporation is None:
|
||||
char.corporation = corp
|
||||
char.save()
|
||||
|
||||
|
||||
@task(ignore_result=True)
|
||||
def import_corp_members(key_id, character_id):
|
||||
|
||||
Reference in New Issue
Block a user