Skip to content

Commit

Permalink
Undo c94803 - there are side-effects I don't fully understand yet
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Jan 17, 2009
1 parent 7793159 commit 2e20fb0
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions unauthorized.py
Expand Up @@ -14,6 +14,7 @@
$Id$
"""

from types import StringType
from zope.interface import implements
from zope.security.interfaces import IUnauthorized

Expand All @@ -37,7 +38,7 @@ def __init__(self, message=None, value=None, needed=None, name=None, **kw):
provides are added to needed.
"""
if name is None and (
not isinstance(message, basestring) or len(message.split()) <= 1):
not isinstance(message, StringType) or len(message.split()) <= 1):
# First arg is a name, not a message
name=message
message=None
Expand All @@ -52,17 +53,8 @@ def __init__(self, message=None, value=None, needed=None, name=None, **kw):

self.needed=needed

# Python has deprecated the message attribute of exceptions in 2.6. We
# will keep it for this exception and avoid the warning.
def _get_message(self, message):
return self._message
def _set_message(self, message):
self._message = message
message = property(_get_message, _set_message)

def __str__(self):
if self.message is not None:
return self.message
if self.message is not None: return self.message
if self.name is not None:
return ("You are not allowed to access '%s' in this context"
% self.name)
Expand All @@ -71,6 +63,7 @@ def __str__(self):
% self.getValueName())
return repr(self)


def getValueName(self):
v=self.value
vname=getattr(v, '__name__', None)
Expand Down

0 comments on commit 2e20fb0

Please sign in to comment.