Skip to content

Commit e7f18c4

Browse files
committed
fixup! prettify XML string output by registering default namespace prefixes
1 parent f941375 commit e7f18c4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/saml2/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ def _to_element_tree(self):
572572
self._add_members_to_element_tree(new_tree)
573573
return new_tree
574574

575-
def register_prefix(self, nspair):
575+
@staticmethod
576+
def register_prefix(nspair):
576577
"""
577578
Register with ElementTree a set of namespaces
578579
@@ -707,7 +708,7 @@ def to_string_force_namespace(self, nspair):
707708

708709
return ElementTree.tostring(elem, encoding="UTF-8")
709710

710-
def to_string(self, nspair=DEFAULT_NS_PREFIXES):
711+
def to_string(self, nspair=None):
711712
"""Converts the Saml object to a string containing XML.
712713
713714
:param nspair: A dictionary of prefixes and uris to use when
@@ -1056,3 +1057,6 @@ def is_required_attribute(cls, attr):
10561057
:return: True if required
10571058
"""
10581059
return cls.c_attributes[attr][REQUIRED]
1060+
1061+
1062+
SamlBase.register_prefix(DEFAULT_NS_PREFIXES)

0 commit comments

Comments
 (0)