Commit 279488f1 authored by Evan Simpson's avatar Evan Simpson

Allow for non-string 'message' argument, as in a failed attempt to access

an element of a sequence.
parent 7aff816e
......@@ -83,9 +83,11 @@
#
##############################################################################
"""
$Id: unauthorized.py,v 1.2 2001/10/19 15:12:28 shane Exp $
$Id: unauthorized.py,v 1.3 2001/11/13 19:22:37 evan Exp $
"""
from types import StringType
class Unauthorized(Exception):
"""Some user wasn't allowed to access a resource"""
......@@ -103,7 +105,8 @@ class Unauthorized(Exception):
(e.g. {'permission': 'add spam'}). Any extra keyword arguments
provides are added to needed.
"""
if name is None and message is not None and len(message.split()) <= 1:
if name is None and (
not isinstance(message, StringType) or len(message.split()) <= 1):
# First arg is a name, not a message
name=message
message=None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment