fix: Put the report location parsing in a try/catch statement as it is an optional field

pull/210/head
chrisr3d 2018-07-30 14:22:40 +02:00
parent a8170ded17
commit 63c3252062
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 6 additions and 3 deletions

View File

@ -87,9 +87,12 @@ class GoAmlGeneration(object):
person_to_parse = [person_uuid for person_uuid in self.uuids.get('person') if person_uuid not in self.parsed_uuids.get('person')] person_to_parse = [person_uuid for person_uuid in self.uuids.get('person') if person_uuid not in self.parsed_uuids.get('person')]
if len(person_to_parse) == 1: if len(person_to_parse) == 1:
self.itterate('person', 'reporting_person', person_to_parse[0], 'header') self.itterate('person', 'reporting_person', person_to_parse[0], 'header')
location_to_parse = [location_uuid for location_uuid in self.uuids.get('geolocation') if location_uuid not in self.parsed_uuids.get('geolocation')] try:
if len(location_to_parse) == 1: location_to_parse = [location_uuid for location_uuid in self.uuids.get('geolocation') if location_uuid not in self.parsed_uuids.get('geolocation')]
self.itterate('geolocation', 'location', location_to_parse[0], 'header') if len(location_to_parse) == 1:
self.itterate('geolocation', 'location', location_to_parse[0], 'header')
except TypeError:
pass
self.xml['data'] += "</report>" self.xml['data'] += "</report>"
def itterate(self, object_type, aml_type, uuid, xml_part): def itterate(self, object_type, aml_type, uuid, xml_part):