Simplified ObjectReference dictionary reading

pull/163/head
chrisr3d 2018-02-13 13:41:22 +01:00
parent b7098d1cff
commit d4538382d0
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
1 changed files with 5 additions and 4 deletions

View File

@ -101,18 +101,19 @@ class GoAmlGeneration(object):
pass
def parse_references(self, object_type, next_object_type, uuid, relationship_type, xml_part):
reference = referencesMapping[next_object_type]
try:
next_aml_type = referencesMapping[next_object_type][object_type].get('aml_type').format(relationship_type.split('_')[0])
next_aml_type = reference[object_type].get('aml_type').format(relationship_type.split('_')[0])
try:
bracket = referencesMapping[next_object_type][object_type].get('bracket').format(relationship_type)
bracket = reference[object_type].get('bracket').format(relationship_type)
self.xml[xml_part] += "<{}>".format(bracket)
self.itterate(next_object_type, next_aml_type, uuid, xml_part)
self.xml[xml_part] += "</{}>".format(bracket)
except KeyError:
self.itterate(next_object_type, next_aml_type, uuid, xml_part)
except KeyError:
next_aml_type = referencesMapping[next_object_type].get('aml_type').format(relationship_type.split('_')[0])
bracket = referencesMapping[next_object_type].get('bracket').format(relationship_type)
next_aml_type = reference.get('aml_type').format(relationship_type.split('_')[0])
bracket = reference.get('bracket').format(relationship_type)
self.xml[xml_part] += "<{}>".format(bracket)
self.itterate(next_object_type, next_aml_type, uuid, xml_part)
self.xml[xml_part] += "</{}>".format(bracket)