Handle possible lack of extensions
This commit is contained in:
@@ -815,14 +815,18 @@ class MetadataStore(object):
|
|||||||
:type entity_id: string
|
:type entity_id: string
|
||||||
:rtype: dict
|
:rtype: dict
|
||||||
"""
|
"""
|
||||||
ext = self.__getitem__(entity_id)["extensions"]
|
|
||||||
res = {}
|
res = {}
|
||||||
|
try:
|
||||||
|
ext = self.__getitem__(entity_id)["extensions"]
|
||||||
|
except KeyError:
|
||||||
|
return res
|
||||||
for elem in ext["extension_elements"]:
|
for elem in ext["extension_elements"]:
|
||||||
if elem["__class__"] == ENTITYATTRIBUTES:
|
if elem["__class__"] == ENTITYATTRIBUTES:
|
||||||
for attr in elem["attribute"]:
|
for attr in elem["attribute"]:
|
||||||
if attr["name"] not in res:
|
if attr["name"] not in res:
|
||||||
res[attr["name"]] = []
|
res[attr["name"]] = []
|
||||||
res[attr["name"]] += [v["text"] for v in attr["attribute_value"]]
|
res[attr["name"]] += [v["text"] for v in attr[
|
||||||
|
"attribute_value"]]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def bindings(self, entity_id, typ, service):
|
def bindings(self, entity_id, typ, service):
|
||||||
|
|||||||
Reference in New Issue
Block a user