Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
b731be27
Commit
b731be27
authored
Jan 17, 2009
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo c94803 - there are side-effects I don't fully understand yet
parent
13de2f4e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
11 deletions
+4
-11
lib/python/zExceptions/unauthorized.py
lib/python/zExceptions/unauthorized.py
+4
-11
No files found.
lib/python/zExceptions/unauthorized.py
View file @
b731be27
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
$Id$
$Id$
"""
"""
from
types
import
StringType
from
zope.interface
import
implements
from
zope.interface
import
implements
from
zope.security.interfaces
import
IUnauthorized
from
zope.security.interfaces
import
IUnauthorized
...
@@ -37,7 +38,7 @@ class Unauthorized(Exception):
...
@@ -37,7 +38,7 @@ class Unauthorized(Exception):
provides are added to needed.
provides are added to needed.
"""
"""
if
name
is
None
and
(
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
# First arg is a name, not a message
name
=
message
name
=
message
message
=
None
message
=
None
...
@@ -52,17 +53,8 @@ class Unauthorized(Exception):
...
@@ -52,17 +53,8 @@ class Unauthorized(Exception):
self
.
needed
=
needed
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
):
def
__str__
(
self
):
if
self
.
message
is
not
None
:
if
self
.
message
is
not
None
:
return
self
.
message
return
self
.
message
if
self
.
name
is
not
None
:
if
self
.
name
is
not
None
:
return
(
"You are not allowed to access '%s' in this context"
return
(
"You are not allowed to access '%s' in this context"
%
self
.
name
)
%
self
.
name
)
...
@@ -71,6 +63,7 @@ class Unauthorized(Exception):
...
@@ -71,6 +63,7 @@ class Unauthorized(Exception):
%
self
.
getValueName
())
%
self
.
getValueName
())
return
repr
(
self
)
return
repr
(
self
)
def
getValueName
(
self
):
def
getValueName
(
self
):
v
=
self
.
value
v
=
self
.
value
vname
=
getattr
(
v
,
'__name__'
,
None
)
vname
=
getattr
(
v
,
'__name__'
,
None
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment