Skip to content

Commit 69c5e07

Browse files
author
Roland Hedberg
committed
Handle possible lack of extensions
1 parent 3740d80 commit 69c5e07

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/saml2/mdstore.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,14 +815,18 @@ def entity_attributes(self, entity_id):
815815
:type entity_id: string
816816
:rtype: dict
817817
"""
818-
ext = self.__getitem__(entity_id)["extensions"]
819818
res = {}
819+
try:
820+
ext = self.__getitem__(entity_id)["extensions"]
821+
except KeyError:
822+
return res
820823
for elem in ext["extension_elements"]:
821824
if elem["__class__"] == ENTITYATTRIBUTES:
822825
for attr in elem["attribute"]:
823826
if attr["name"] not in res:
824827
res[attr["name"]] = []
825-
res[attr["name"]] += [v["text"] for v in attr["attribute_value"]]
828+
res[attr["name"]] += [v["text"] for v in attr[
829+
"attribute_value"]]
826830
return res
827831

828832
def bindings(self, entity_id, typ, service):

0 commit comments

Comments
 (0)