Skip to content

Commit

Permalink
avoid adding more than one
Browse files Browse the repository at this point in the history
  • Loading branch information
leifj committed Feb 1, 2019
1 parent b5f3bb7 commit 2cb735c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pyff/samlmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,8 @@ def set_nodecountry(e, country_code):
raise MetadataException("I can only add NodeCountry to EntityDescriptor elements")

def _set_nodecountry_in_ext(ext_elt, iso_cc):
if ext_elt is not None and not ext_elt.find("{%s}NodeCountry" % NS['eidas']):
nc_elt = ext_elt.find("./{%s}NodeCountry" % NS['eidas'])
if ext_elt is not None and nc_elt is None:
velt = etree.Element("{%s}NodeCountry" % NS['eidas'])
velt.text = iso_cc
ext_elt.append(velt)
Expand Down

0 comments on commit 2cb735c

Please sign in to comment.