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
0cb01170
Commit
0cb01170
authored
Apr 19, 2010
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- backported changes from trunk
parent
8ac25879
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
38 deletions
+8
-38
src/OFS/SimpleItem.py
src/OFS/SimpleItem.py
+8
-38
No files found.
src/OFS/SimpleItem.py
View file @
0cb01170
...
...
@@ -20,12 +20,10 @@ item types.
$Id$
"""
import
inspect
import
marshal
import
re
import
sys
import
time
import
warnings
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityManagement
import
getSecurityManager
...
...
@@ -118,7 +116,7 @@ class Item(Base,
# Alias id to __name__, which will make tracebacks a good bit nicer:
__name__
=
ComputedAttribute
(
lambda
self
:
self
.
getId
())
# Name, relative to
SOFTWARE_URL
of icon used to display item
# Name, relative to
BASEPATH1
of icon used to display item
# in folder listings.
icon
=
''
...
...
@@ -239,35 +237,10 @@ class Item(Base,
handle_errors
=
getattr
(
getattr
(
REQUEST
,
'RESPONSE'
,
None
),
'handle_errors'
,
False
)
# Can we re-raise the exception with a rendered-to-HTML
# exception value? To be able to do so, the exception
# constructor needs to be able to take more than two
# arguments (some Zope 3 exceptions can't).
can_raise
=
False
ctor
=
getattr
(
error_type
,
'__init__'
,
None
)
if
inspect
.
ismethoddescriptor
(
ctor
):
# If it's a method descriptor, it means we've got a
# base ``__init__`` method that was not overriden,
# likely from the base ``Exception`` class.
can_raise
=
True
else
:
if
inspect
.
ismethod
(
ctor
):
ctor
=
getattr
(
ctor
,
'im_func'
,
None
)
if
inspect
.
isbuiltin
(
ctor
):
# In Python 2.4, the ``__init__`` method of the
# base ``Exception`` class is a ``builtin
# method``.
can_raise
=
True
elif
ctor
is
not
None
and
inspect
.
isfunction
(
ctor
):
can_raise
=
(
len
(
inspect
.
getargspec
(
error_type
.
__init__
)[
0
])
>
2
)
if
not
(
can_raise
and
handle_errors
):
# If we have been asked not to handle errors and we
# can't re-raise a transformed exception don't even
# bother with transforming the exception into
# HTML. Just re-raise the original exception right
# away.
if
not
handle_errors
:
# If we have been asked not to handle errors don't even bother
# with transforming the exception into HTML. Just re-raise the
# original exception right away.
raise
error_type
,
error_value
,
tb
try
:
...
...
@@ -306,12 +279,9 @@ class Item(Base,
html_quote
(
sys
.
exc_info
()[
1
]),
))
if
handle_errors
:
# If we've been asked to handle errors, just
# return the rendered exception and let the
# ZPublisher Exception Hook deal with it.
return
error_type
,
v
,
tb
raise
error_type
,
v
,
tb
# If we've been asked to handle errors, just return the rendered
# exception and let the ZPublisher Exception Hook deal with it.
return
error_type
,
v
,
tb
finally
:
if
hasattr
(
self
,
'_v_eek'
):
del
self
.
_v_eek
tb
=
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