From 58d19b2d4f737c8b438c90e76fd3d5f6ced14cf4 Mon Sep 17 00:00:00 2001 From: Andrew Wason Date: Tue, 23 Apr 2013 10:55:17 -0400 Subject: [PATCH] Status error responses don't always have a message. --- src/saml2/response.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/saml2/response.py b/src/saml2/response.py index f4111bb..9d5acc4 100644 --- a/src/saml2/response.py +++ b/src/saml2/response.py @@ -327,9 +327,12 @@ class StatusResponse(object): status.status_code.status_code.value] else: excep = StatusError + if status.status_message: + msg = status.status_message.text + else: + msg = "Unknown error" raise excep( - "%s from %s" % (status.status_message.text, - status.status_code.value,)) + "%s from %s" % (msg, status.status_code.value,)) return True def issue_instant_ok(self):