Should have wanted a 'other' error code but lacking that this might be the best choice

This commit is contained in:
Roland Hedberg
2010-10-06 09:09:53 +02:00
parent 9147200399
commit b4a7139c61

View File

@@ -137,13 +137,17 @@ def identity_attribute(form, attribute, forward_map=None):
def error_status_factory(info): def error_status_factory(info):
if isinstance(info, Exception): if isinstance(info, Exception):
try:
exc_val = EXCEPTION2STATUS[info.__class__]
except KeyError:
exc_val = samlp.STATUS_AUTHN_FAILED
msg = info.args[0] msg = info.args[0]
status = samlp.Status( status = samlp.Status(
status_message=samlp.StatusMessage(text=msg), status_message=samlp.StatusMessage(text=msg),
status_code=samlp.StatusCode( status_code=samlp.StatusCode(
value=samlp.STATUS_RESPONDER, value=samlp.STATUS_RESPONDER,
status_code=samlp.StatusCode( status_code=samlp.StatusCode(
value=EXCEPTION2STATUS[info.__class__]) value=exc_val)
), ),
) )
else: else: