diff options
author | Rebecka Gulliksson <rebecka.gulliksson@umu.se> | 2016-05-17 21:11:10 +0200 |
---|---|---|
committer | Rebecka Gulliksson <rebecka.gulliksson@umu.se> | 2016-05-17 21:11:10 +0200 |
commit | 3a839e6ea9398d353f58718b7dd104aa1798a6f6 (patch) | |
tree | b1dd681874c6026d12d48d6be02843c8faa7e662 /src/saml2/assertion.py | |
parent | 255c34e334c41bf1b115caa03531504af66db504 (diff) | |
download | pysaml2-3a839e6ea9398d353f58718b7dd104aa1798a6f6.tar.gz |
Don't catch KeyError over too broad statement.
Previously KeyError in lower level of implementation,
MetadataStore.entity_categories(), was caught instead of being
propagated.
Diffstat (limited to 'src/saml2/assertion.py')
-rw-r--r-- | src/saml2/assertion.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/saml2/assertion.py b/src/saml2/assertion.py index 35a11dd0..adfeecd7 100644 --- a/src/saml2/assertion.py +++ b/src/saml2/assertion.py @@ -273,13 +273,8 @@ def post_entity_categories(maps, **kwargs): required = [] if kwargs["mds"]: - try: + if "sp_entity_id" in kwargs: ecs = kwargs["mds"].entity_categories(kwargs["sp_entity_id"]) - except KeyError: - for ec_map in maps: - for attr in ec_map[""]: - restrictions[attr] = None - else: for ec_map in maps: for key, (atlist, only_required) in ec_map.items(): if key == "": # always released @@ -305,6 +300,10 @@ def post_entity_categories(maps, **kwargs): for attr in attrs: restrictions[attr] = None + else: + for ec_map in maps: + for attr in ec_map[""]: + restrictions[attr] = None return restrictions |