summaryrefslogtreecommitdiff
path: root/src/saml2/soap.py
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2013-01-13 19:35:11 +0100
committerRoland Hedberg <roland.hedberg@adm.umu.se>2013-01-13 19:35:11 +0100
commitf23962accafb13c2b70d9e4904ec966677e66ec1 (patch)
tree3b290c8119d364f38f7c2fb603e5dadea8cd7a15 /src/saml2/soap.py
parentfdc0555c418f7d223d4ba7f5a69f6e6c6382f6f6 (diff)
downloadpysaml2-f23962accafb13c2b70d9e4904ec966677e66ec1.tar.gz
Raise exception instead of returning empty string.
Diffstat (limited to 'src/saml2/soap.py')
-rw-r--r--src/saml2/soap.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/saml2/soap.py b/src/saml2/soap.py
index 6f95ad54..e172e7d9 100644
--- a/src/saml2/soap.py
+++ b/src/saml2/soap.py
@@ -39,6 +39,9 @@ logger = logging.getLogger(__name__)
class XmlParseError(Exception):
pass
+class WrongMessageType(Exception):
+ pass
+
def parse_soap_enveloped_saml_response(text):
tags = ['{%s}Response' % SAMLP_NAMESPACE,
'{%s}LogoutResponse' % SAMLP_NAMESPACE]
@@ -103,7 +106,8 @@ def parse_soap_enveloped_saml_thingy(text, expected_tags):
if saml_part.tag in expected_tags:
return ElementTree.tostring(saml_part, encoding="UTF-8")
else:
- return ""
+ raise WrongMessageType("Was '%s' expected '%s'" % (saml_part.tag,
+ expected_tags))
import re