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
c2c58b42
Commit
c2c58b42
authored
Oct 23, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent traceback leaks.
parent
208e5a18
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
18 deletions
+32
-18
lib/python/Products/PageTemplates/Expressions.py
lib/python/Products/PageTemplates/Expressions.py
+11
-10
lib/python/Products/PageTemplates/TALES.py
lib/python/Products/PageTemplates/TALES.py
+8
-4
lib/python/Products/PageTemplates/ZopePageTemplate.py
lib/python/Products/PageTemplates/ZopePageTemplate.py
+3
-2
lib/python/TAL/TALDefs.py
lib/python/TAL/TALDefs.py
+5
-0
lib/python/TAL/TALInterpreter.py
lib/python/TAL/TALInterpreter.py
+5
-2
No files found.
lib/python/Products/PageTemplates/Expressions.py
View file @
c2c58b42
...
...
@@ -89,7 +89,7 @@ Page Template-specific implementation of TALES, with handlers
for Python expressions, string literals, and paths.
"""
__version__
=
'$Revision: 1.2
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
import
re
,
sys
from
TALES
import
Engine
,
CompilerError
,
_valid_name
,
NAME_RE
,
\
...
...
@@ -180,16 +180,17 @@ class PathExpr:
vars
=
econtext
.
vars
exists
=
0
for
base
,
path
,
dp
in
self
.
_paths
:
path
=
list
(
path
)
# Copy!
# Expand dynamic path parts from right to left.
for
i
,
varname
in
dp
:
val
=
vars
[
varname
]
if
isinstance
(
val
,
StringType
):
path
[
i
]
=
val
else
:
# If the value isn't a string, assume it's a sequence
# of path names.
path
[
i
:
i
+
1
]
=
list
(
val
)
if
dp
:
path
=
list
(
path
)
# Copy!
for
i
,
varname
in
dp
:
val
=
vars
[
varname
]
if
isinstance
(
val
,
StringType
):
path
[
i
]
=
val
else
:
# If the value isn't a string, assume it's a sequence
# of path names.
path
[
i
:
i
+
1
]
=
list
(
val
)
try
:
__traceback_info__
=
base
if
base
==
'CONTEXTS'
:
...
...
lib/python/Products/PageTemplates/TALES.py
View file @
c2c58b42
...
...
@@ -87,7 +87,7 @@
An implementation of a generic TALES engine
"""
__version__
=
'$Revision: 1.2
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
import
re
,
sys
,
ZTUtils
from
MultiMapping
import
MultiMapping
...
...
@@ -107,7 +107,11 @@ class TALESError(Exception):
self
.
setPosition
(
position
)
def
setPosition
(
self
,
position
):
self
.
lineno
=
position
[
0
]
self
.
offset
=
position
[
1
]
self
.
offset
=
position
[
1
]
def
takeTraceback
(
self
):
t
=
self
.
traceback
self
.
traceback
=
None
return
t
def
__str__
(
self
):
if
self
.
type
is
None
:
s
=
self
.
expression
...
...
@@ -314,8 +318,8 @@ class Context:
try
:
v
=
expression
(
self
)
if
isinstance
(
v
,
Exception
):
if
hasattr
(
v
,
'traceback'
):
raise
v
,
None
,
v
.
t
raceback
if
isinstance
(
v
,
TALESError
):
raise
v
,
None
,
v
.
t
akeTraceback
()
raise
v
except
TALESError
,
err
:
err
.
setPosition
(
self
.
position
)
...
...
lib/python/Products/PageTemplates/ZopePageTemplate.py
View file @
c2c58b42
...
...
@@ -87,7 +87,7 @@
Zope object encapsulating a Page Template.
"""
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
4
$'
[
11
:
-
2
]
import
os
,
AccessControl
,
Acquisition
,
sys
from
Globals
import
DTMLFile
,
ImageFile
,
MessageDialog
,
package_home
...
...
@@ -275,7 +275,8 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
result
=
self
.
pt_render
(
extra_context
=
bound_names
)
except
TALESError
,
err
:
if
err
.
type
==
'Unauthorized'
:
raise
err
.
type
,
err
.
value
,
err
.
traceback
raise
err
.
type
,
err
.
value
,
err
.
takeTraceback
()
err
.
takeTraceback
()
raise
if
keyset
is
not
None
:
# Store the result in the cache.
...
...
lib/python/TAL/TALDefs.py
View file @
c2c58b42
...
...
@@ -140,6 +140,11 @@ class TALESError(TALError):
# This exception can carry around another exception + traceback
def
takeTraceback
(
self
):
t
=
self
.
info
[
2
]
self
.
info
=
self
.
info
[:
2
]
+
(
None
,)
return
t
def
__init__
(
self
,
msg
,
position
=
(
None
,
None
),
info
=
(
None
,
None
,
None
)):
t
,
v
,
tb
=
info
if
t
:
...
...
lib/python/TAL/TALInterpreter.py
View file @
c2c58b42
...
...
@@ -637,8 +637,11 @@ class TALInterpreter:
engine
.
beginScope
()
err
.
lineno
,
err
.
offset
=
self
.
position
engine
.
setLocal
(
'error'
,
err
)
self
.
interpret
(
handler
)
engine
.
endScope
()
try
:
self
.
interpret
(
handler
)
finally
:
err
.
takeTraceback
()
engine
.
endScope
()
else
:
self
.
restoreOutputState
(
state
)
self
.
stream_write
(
stream
.
getvalue
())
...
...
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