summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Lundberg <lundberg@sunet.se>2018-10-04 15:49:54 +0200
committerJohan Lundberg <lundberg@sunet.se>2018-10-04 15:49:54 +0200
commit93df65fed8f4b6a0aef3b17d516cbfcf519efd6b (patch)
tree1681e48b51569f5743f63cde5fdb0a603bf03c4b
parent77429beb90e49c6876bb1693e11247b1c786f18d (diff)
downloadpysaml2-93df65fed8f4b6a0aef3b17d516cbfcf519efd6b.tar.gz
Handle non ascii characters in __str__
-rw-r--r--src/saml2/response.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/saml2/response.py b/src/saml2/response.py
index cb3deac5..a8024fef 100644
--- a/src/saml2/response.py
+++ b/src/saml2/response.py
@@ -1,10 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-
+from future.utils import python_2_unicode_compatible
import calendar
import logging
import six
+
from saml2.samlp import STATUS_VERSION_MISMATCH
from saml2.samlp import STATUS_AUTHN_FAILED
from saml2.samlp import STATUS_INVALID_ATTR_NAME_OR_VALUE
@@ -460,7 +461,7 @@ class ManageNameIDResponse(StatusResponse):
# ----------------------------------------------------------------------------
-
+@python_2_unicode_compatible
class AuthnResponse(StatusResponse):
""" This is where all the profile compliance is checked.
This one does saml2int compliance. """
@@ -1081,9 +1082,9 @@ class AuthnResponse(StatusResponse):
"session_index": authn_statement.session_index}
def __str__(self):
- if not isinstance(self.xmlstr, six.string_types):
- return "%s" % self.xmlstr.decode("utf-8")
- return "%s" % self.xmlstr
+ if isinstance(self.xmlstr, six.string_types):
+ return self.xmlstr
+ return str(self.xmlstr)
def verify_recipient(self, recipient):
"""