Skip to content

Commit 7133f72

Browse files
author
Richard Jones
committed
merged Zope Collector #372 fix from ZPT CVS trunk
1 parent 7139fe6 commit 7133f72

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

roundup/cgi/PageTemplates/PythonExpr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
"""
2121

22-
__version__='$Revision: 1.3 $'[11:-2]
22+
__version__='$Revision: 1.4 $'[11:-2]
2323

2424
from TALES import CompilerError
2525
from string import strip, split, join, replace, lstrip
@@ -53,7 +53,7 @@ def _bind_used_names(self, econtext):
5353
# Bind template variables
5454
names = {}
5555
vars = econtext.vars
56-
getType = econtext._engine.getTypes().get
56+
getType = econtext.getCompiler().getTypes().get
5757
for vname in self._f_varnames:
5858
has, val = vars.has_get(vname)
5959
if not has:
@@ -83,5 +83,5 @@ def __init__(self, name, handler, econtext):
8383
self._econtext = econtext
8484
def __call__(self, text):
8585
return self._handler(self._name, text,
86-
self._econtext._engine)(self._econtext)
86+
self._econtext.getCompiler())(self._econtext)
8787

roundup/cgi/PageTemplates/TALES.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- changed imports to import from roundup.cgi
2020
"""
2121

22-
__version__='$Revision: 1.3 $'[11:-2]
22+
__version__='$Revision: 1.4 $'[11:-2]
2323

2424
import re, sys
2525
from roundup.cgi import ZTUtils
@@ -160,8 +160,8 @@ class Context:
160160
position = (None, None)
161161
source_file = None
162162

163-
def __init__(self, engine, contexts):
164-
self._engine = engine
163+
def __init__(self, compiler, contexts):
164+
self._compiler = compiler
165165
self.contexts = contexts
166166
contexts['nothing'] = None
167167
contexts['default'] = Default
@@ -178,6 +178,9 @@ def __init__(self, engine, contexts):
178178
# Keep track of what needs to be popped as each scope ends.
179179
self._scope_stack = []
180180

181+
def getCompiler(self):
182+
return self._compiler
183+
181184
def beginScope(self):
182185
self._scope_stack.append([self.local_vars.copy()])
183186

@@ -206,8 +209,8 @@ def setGlobal(self, name, value):
206209
def setRepeat(self, name, expr):
207210
expr = self.evaluate(expr)
208211
if not expr:
209-
return self._engine.Iterator(name, (), self)
210-
it = self._engine.Iterator(name, expr, self)
212+
return self._compiler.Iterator(name, (), self)
213+
it = self._compiler.Iterator(name, expr, self)
211214
old_value = self.repeat_vars.get(name)
212215
self._scope_stack[-1].append((name, old_value))
213216
self.repeat_vars[name] = it
@@ -216,7 +219,7 @@ def setRepeat(self, name, expr):
216219
def evaluate(self, expression,
217220
isinstance=isinstance, StringType=StringType):
218221
if isinstance(expression, StringType):
219-
expression = self._engine.compile(expression)
222+
expression = self._compiler.compile(expression)
220223
__traceback_supplement__ = (
221224
TALESTracebackSupplement, self, expression)
222225
v = expression(self)

0 commit comments

Comments
 (0)