def resolve_extra_info_object(character, key, value): if key == "structure_id" or key == "station_id": Structure.verify_object_exists(value, character.pk) elif key == "type_id": ObjectType.verify_object_exists(value) elif key == "character_id": # fix inaccurate CCP data # CCP uses character_id as a catch-all key for special extra_info types that aren't defined. actual_type = CcpIdTypeResolver.get_id_type(value) if actual_type == "character": EVEPlayerCharacter.verify_object_exists(value) else: logger.error("getting incorrect character_id journal thing for type id %s actual_Type: %s" % (value, actual_type)) return None,None elif key == "corporation_id": EVEPlayerCorporation.verify_object_exists(value) elif key == "alliance_id": EVEPlayerAlliance.verify_object_exists(value) elif key == "system_id": System.verify_object_exists(value) elif key == "market_transaction_id" or key == "industry_job_id" or key == "contract_id" or key == "planet_id" or key == "eve_system": #idgaf pass else: raise Exception("ccp returning some fancy new key object? %s %s" % (key,value) ) return (key,value)
def verify_generic_object_exists(object_type, ccp_object_id): """ Used by wallet/evemail endpoints since they have fields that are generic object ids :param object_type: :param object_pk: :return: """ if object_type == "character": EVEPlayerCharacter.verify_object_exists(ccp_object_id) elif object_type == "corporation": EVEPlayerCorporation.verify_object_exists(ccp_object_id) elif object_type == "alliance": EVEPlayerAlliance.verify_object_exists(ccp_object_id) elif object_type == "system": System.verify_object_exists(ccp_object_id) elif object_type == "mailing_list": CcpIdTypeResolver.add_type(ccp_object_id, "mailing_list") pass elif object_type == "eve_system": return elif object_type == "faction": CcpIdTypeResolver.add_type(ccp_object_id, "faction") else: raise Exception("not implemented %s id %s" % (object_type, ccp_object_id))