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
c7f71399
Commit
c7f71399
authored
Apr 20, 1999
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added documentation of error_type, error_value and error_tb. Also added error_tb implementation.
parent
6a207dcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
lib/python/DocumentTemplate/DT_Try.py
lib/python/DocumentTemplate/DT_Try.py
+17
-3
No files found.
lib/python/DocumentTemplate/DT_Try.py
View file @
c7f71399
...
...
@@ -83,7 +83,8 @@
#
##############################################################################
import
string
,
sys
import
string
,
sys
,
traceback
from
cStringIO
import
StringIO
from
DT_Util
import
parse_params
,
render_blocks
,
namespace
,
InstanceDict
class
Try
:
...
...
@@ -106,7 +107,16 @@ class Try:
no name then it matches all raised errors.
The try tag understands class-based exceptions, as well as string-based
exceptions. Note the raise tag raises string-based exceptions.
exceptions. Note: the 'raise' tag raises string-based exceptions.
Inside the except blocks information about the error is available via
three variables.
'error_type' -- This variable is the name of the exception caught.
'error_value' -- This is the caught exception's value.
'error_tb' -- This is a traceback for the caught exception.
Original version by Jordan B. Baker.
"""
...
...
@@ -149,7 +159,11 @@ class Try:
# found the handler block, now render it
try
:
ns
=
namespace
(
self
,
error_type
=
errname
,
error_message
=
einfo
[
1
])[
0
]
f
=
StringIO
()
traceback
.
print_exc
(
100
,
f
)
error_tb
=
f
.
getvalue
()
ns
=
namespace
(
self
,
error_type
=
errname
,
error_value
=
einfo
[
1
],
error_tb
=
error_tb
)[
0
]
md
.
_push
(
InstanceDict
(
ns
,
md
))
return
render_blocks
(
handler
,
md
)
finally
:
...
...
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