[ZPT] CVS: Releases/Zope/lib/python/Products/PageTemplates - Expressions.py:1.23 TALES.py:1.23 ZopePageTemplate.py:1.24
Evan Simpson
evan@zope.com
Tue, 23 Oct 2001 15:15:03 -0400
Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv10343/Products/PageTemplates
Modified Files:
Expressions.py TALES.py ZopePageTemplate.py
Log Message:
Prevent traceback leaks.
=== Releases/Zope/lib/python/Products/PageTemplates/Expressions.py 1.22 => 1.23 ===
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':
=== Releases/Zope/lib/python/Products/PageTemplates/TALES.py 1.22 => 1.23 ===
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 @@
try:
v = expression(self)
if isinstance(v, Exception):
- if hasattr(v, 'traceback'):
- raise v, None, v.traceback
+ if isinstance(v, TALESError):
+ raise v, None, v.takeTraceback()
raise v
except TALESError, err:
err.setPosition(self.position)
=== Releases/Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.23 => 1.24 ===
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.