[ZPT] CVS: Releases/Zope/lib/python/Products/PageTemplates - PythonExpr.py:1.8.6.3 TALES.py:1.31.6.7
Evan Simpson
evan@zope.com
Wed, 9 Oct 2002 10:38:08 -0400
Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv19845/lib/python/Products/PageTemplates
Modified Files:
Tag: Zope-2_6-branch
PythonExpr.py TALES.py
Log Message:
Fix Collector #372 by having TALInterpreter fetch the expression compiler from the execution context when it parses
inserted structural text.
=== Releases/Zope/lib/python/Products/PageTemplates/PythonExpr.py 1.8.6.2 => 1.8.6.3 ===
--- Releases/Zope/lib/python/Products/PageTemplates/PythonExpr.py:1.8.6.2 Thu Sep 19 10:45:11 2002
+++ Releases/Zope/lib/python/Products/PageTemplates/PythonExpr.py Wed Oct 9 10:37:37 2002
@@ -47,7 +47,7 @@
# Bind template variables
names = {}
vars = econtext.vars
- getType = econtext._engine.getTypes().get
+ getType = econtext.getCompiler().getTypes().get
for vname in self._f_varnames:
val = vars.get(vname, _marker)
if val is _marker:
@@ -78,5 +78,5 @@
self._econtext = econtext
def __call__(self, text):
return self._handler(self._name, text,
- self._econtext._engine)(self._econtext)
+ self._econtext.getCompiler())(self._econtext)
=== Releases/Zope/lib/python/Products/PageTemplates/TALES.py 1.31.6.6 => 1.31.6.7 ===
--- Releases/Zope/lib/python/Products/PageTemplates/TALES.py:1.31.6.6 Wed Sep 25 20:33:51 2002
+++ Releases/Zope/lib/python/Products/PageTemplates/TALES.py Wed Oct 9 10:37:37 2002
@@ -152,8 +152,8 @@
position = (None, None)
source_file = None
- def __init__(self, engine, contexts):
- self._engine = engine
+ def __init__(self, compiler, contexts):
+ self._compiler = compiler
self.contexts = contexts
contexts['nothing'] = None
contexts['default'] = Default
@@ -170,6 +170,9 @@
# Keep track of what needs to be popped as each scope ends.
self._scope_stack = []
+ def getCompiler(self):
+ return self._compiler
+
def beginScope(self):
self._scope_stack.append([self.local_vars.copy()])
@@ -198,8 +201,8 @@
def setRepeat(self, name, expr):
expr = self.evaluate(expr)
if not expr:
- return self._engine.Iterator(name, (), self)
- it = self._engine.Iterator(name, expr, self)
+ return self._compiler.Iterator(name, (), self)
+ it = self._compiler.Iterator(name, expr, self)
old_value = self.repeat_vars.get(name)
self._scope_stack[-1].append((name, old_value))
self.repeat_vars[name] = it
@@ -208,7 +211,7 @@
def evaluate(self, expression,
isinstance=isinstance, StringType=StringType):
if isinstance(expression, StringType):
- expression = self._engine.compile(expression)
+ expression = self._compiler.compile(expression)
__traceback_supplement__ = (
TALESTracebackSupplement, self, expression)
return expression(self)