Fix variable issue in the loop

pull/388/head
Golbark 2020-04-08 01:07:46 -07:00
parent 500f0301a9
commit fd3c62c460
1 changed files with 6 additions and 4 deletions

View File

@ -193,13 +193,15 @@ def check_if_present(object, attribute_name, list_objects):
using attribute_name for the matching using attribute_name for the matching
""" """
for o in list_objects: for o in list_objects:
# We first look for a match on the name
if o['name'] == object['name']: if o['name'] == object['name']:
for attr in object['Attribute']: for attr in object['Attribute']:
# Within the attributes, we look for the one to compare
if attr['type'] == attribute_name: if attr['type'] == attribute_name:
value = attr['value'] # Then we check the attributes of the other object and look for a match
for attr2 in o['Attribute']: for attr2 in o['Attribute']:
if attr['type'] == attribute_name and attr['value'] == value: if attr2['type'] == attribute_name and attr2['value'] == attr['value']:
return True return True
return False return False