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
13ab7094
Commit
13ab7094
authored
Nov 23, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First crack at updating error handling to work with 1.5
parent
f811e9d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
43 deletions
+32
-43
lib/python/OFS/Document.py
lib/python/OFS/Document.py
+6
-29
lib/python/OFS/SimpleItem.py
lib/python/OFS/SimpleItem.py
+26
-14
No files found.
lib/python/OFS/Document.py
View file @
13ab7094
"""Document object"""
__version__
=
'$Revision: 1.6
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.6
7
$'
[
11
:
-
2
]
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
,
lower
...
...
@@ -76,34 +76,11 @@ class Document(cDocument, HTML, Explicit,
if
RESPONSE
is
None
:
return
r
return
decapitate
(
r
,
RESPONSE
)
try
:
try
:
r
=
apply
(
HTML
.
__call__
,
(
self
,
client
,
REQUEST
),
kw
)
except
:
if
self
.
id
()
==
'standard_error_message'
:
raise
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
error_type
=
sys
.
exc_type
error_value
=
sys
.
exc_value
tb
=
sys
.
exc_traceback
if
lower
(
error_type
)
in
(
'redirect'
,):
raise
error_type
,
error_value
,
tb
if
(
type
(
error_value
)
is
type
(
''
)
and
regex
.
search
(
'[a-zA-Z]>'
,
error_value
)
>
0
):
error_message
=
error_value
else
:
error_message
=
''
error_tb
=
pretty_tb
(
error_type
,
error_value
,
tb
)
if
client
is
not
None
:
c
=
client
else
:
c
=
self
.
aq_parent
try
:
s
=
getattr
(
c
,
'standard_error_message'
)
v
=
HTML
.
__call__
(
s
,
c
,
REQUEST
,
error_type
=
error_type
,
error_value
=
error_value
,
error_tb
=
error_tb
,
error_traceback
=
error_tb
,
error_message
=
error_message
)
except
:
v
=
'Sorry, an error occured'
raise
error_type
,
v
,
tb
finally
:
tb
=
None
try
:
r
=
apply
(
HTML
.
__call__
,
(
self
,
client
,
REQUEST
),
kw
)
except
:
if
self
.
id
()
==
'standard_error_message'
:
raise
sys
.
exc_type
,
sys
.
exc_value
,
sys
.
exc_traceback
return
self
.
raise_standardErrorMessage
(
client
,
REQUEST
)
if
RESPONSE
is
None
:
return
r
return
decapitate
(
r
,
RESPONSE
)
...
...
lib/python/OFS/SimpleItem.py
View file @
13ab7094
...
...
@@ -16,13 +16,14 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new
item types.
$Id: SimpleItem.py,v 1.2
2 1998/08/03 13:32:39
jim Exp $'''
__version__
=
'$Revision: 1.2
2
$'
[
11
:
-
2
]
$Id: SimpleItem.py,v 1.2
3 1998/11/23 22:57:05
jim Exp $'''
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
import
regex
,
sys
,
Globals
,
App
.
Management
from
DateTime
import
DateTime
from
CopySupport
import
CopySource
from
string
import
join
,
lower
from
types
import
InstanceType
,
StringType
HTML
=
Globals
.
HTML
...
...
@@ -82,26 +83,34 @@ class Item(CopySource, App.Management.Tabs):
def
manage_editedDialog
(
self
,
REQUEST
,
**
args
):
return
apply
(
self
.
_manage_editedDialog
,(
self
,
REQUEST
),
args
)
def
raise_standardErrorMessage
(
self
,
client
=
None
,
REQUEST
=
{},
error_type
=
None
,
error_value
=
None
,
tb
=
None
,
error_tb
=
None
,
error_message
=
''
):
def
raise_standardErrorMessage
(
self
,
client
=
None
,
REQUEST
=
{},
error_type
=
None
,
error_value
=
None
,
tb
=
None
,
error_tb
=
None
,
error_message
=
''
,
tagSearch
=
regex
.
compile
(
'[a-zA-Z]>'
).
search
):
try
:
if
not
error_type
:
error_type
=
sys
.
exc_type
if
not
error_value
:
error_value
=
sys
.
exc_value
if
error_type
is
None
:
error_type
=
sys
.
exc_info
()[
0
]
if
error_value
is
None
:
error_value
=
sys
.
exc_info
()[
1
]
# allow for a few different traceback options
if
tb
is
None
and
(
error_tb
is
None
)
:
tb
=
sys
.
exc_
traceback
if
type
(
tb
)
is
not
type
(
''
)
and
(
error_tb
is
None
):
if
tb
is
None
and
error_tb
is
None
:
tb
=
sys
.
exc_
info
()[
2
]
if
type
(
tb
)
is
not
type
(
''
)
and
(
error_tb
is
None
):
error_tb
=
pretty_tb
(
error_type
,
error_value
,
tb
)
elif
type
(
tb
)
is
type
(
''
)
and
not
error_tb
:
error_tb
=
tb
if
lower
(
error_type
)
in
(
'redirect'
,):
if
lower
(
str
(
error_type
)
)
in
(
'redirect'
,):
raise
error_type
,
error_value
,
tb
if
(
type
(
error_value
)
is
type
(
''
)
and
not
error_message
and
regex
.
search
(
'[a-zA-Z]>'
,
error_value
)
>
0
):
error_message
=
error_value
if
not
error_message
:
if
type
(
error_value
)
is
InstanceType
:
s
=
str
(
error_value
)
if
tagSearch
(
s
)
>=
0
:
error_message
=
error_value
elif
(
type
(
error_value
)
is
StringType
and
tagSearch
(
error_value
)
>=
0
):
error_message
=
error_value
if
client
is
None
:
client
=
self
if
not
REQUEST
:
REQUEST
=
self
.
aq_acquire
(
'REQUEST'
)
...
...
@@ -182,6 +191,9 @@ def pretty_tb(t,v,tb):
##############################################################################
#
# $Log: SimpleItem.py,v $
# Revision 1.23 1998/11/23 22:57:05 jim
# First crack at updating error handling to work with 1.5
#
# Revision 1.22 1998/08/03 13:32:39 jim
# Made manage a redirect rather than an alias.
#
...
...
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