summaryrefslogtreecommitdiff
path: root/src/saml2/__init__.py
diff options
context:
space:
mode:
authorClint Byrum <clint@fewbar.com>2015-05-20 23:42:53 -0700
committerClint Byrum <clint@fewbar.com>2015-05-21 00:13:26 -0700
commitda21b279e2fa7d5c94ec370c02a7507f91d8ce43 (patch)
tree28b67cbf52153dd863dc88676ede973bd2b3aada /src/saml2/__init__.py
parent153de086452652dfb9a81f466e30f2ff305d371a (diff)
downloadpysaml2-da21b279e2fa7d5c94ec370c02a7507f91d8ce43.tar.gz
Fix xml issues with python3
Some calls in etree will return bytes where they used to return a string type.
Diffstat (limited to 'src/saml2/__init__.py')
-rw-r--r--src/saml2/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/saml2/__init__.py b/src/saml2/__init__.py
index 87bfafa6..5d3c3514 100644
--- a/src/saml2/__init__.py
+++ b/src/saml2/__init__.py
@@ -674,7 +674,11 @@ class SamlBase(ExtensionContainer):
return ElementTree.tostring(self._to_element_tree(), encoding="UTF-8")
def __str__(self):
- return self.to_string()
+ # Yes this is confusing. http://bugs.python.org/issue10942
+ x = self.to_string()
+ if not isinstance(x, six.string_types):
+ x = x.decode('utf-8')
+ return x
def keyswv(self):
""" Return the keys of attributes or children that has values