From: richard Date: Thu, 10 Oct 2002 03:48:02 +0000 (+0000) Subject: merged Zope Collector #372 fix from ZPT CVS trunk X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fd106b61ea228a4d4416f1073fe8edb606a37de9;p=roundup.git merged Zope Collector #372 fix from ZPT CVS trunk git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1330 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/cgi/PageTemplates/PythonExpr.py b/roundup/cgi/PageTemplates/PythonExpr.py index a8f06d5..0bfe400 100644 --- a/roundup/cgi/PageTemplates/PythonExpr.py +++ b/roundup/cgi/PageTemplates/PythonExpr.py @@ -19,7 +19,7 @@ Modified for Roundup 0.5 release: """ -__version__='$Revision: 1.3 $'[11:-2] +__version__='$Revision: 1.4 $'[11:-2] from TALES import CompilerError from string import strip, split, join, replace, lstrip @@ -53,7 +53,7 @@ class PythonExpr: # Bind template variables names = {} vars = econtext.vars - getType = econtext._engine.getTypes().get + getType = econtext.getCompiler().getTypes().get for vname in self._f_varnames: has, val = vars.has_get(vname) if not has: @@ -83,5 +83,5 @@ class ExprTypeProxy: self._econtext = econtext def __call__(self, text): return self._handler(self._name, text, - self._econtext._engine)(self._econtext) + self._econtext.getCompiler())(self._econtext) diff --git a/roundup/cgi/PageTemplates/TALES.py b/roundup/cgi/PageTemplates/TALES.py index d29e8a7..229064c 100644 --- a/roundup/cgi/PageTemplates/TALES.py +++ b/roundup/cgi/PageTemplates/TALES.py @@ -19,7 +19,7 @@ Modified for Roundup 0.5 release: - changed imports to import from roundup.cgi """ -__version__='$Revision: 1.3 $'[11:-2] +__version__='$Revision: 1.4 $'[11:-2] import re, sys from roundup.cgi import ZTUtils @@ -160,8 +160,8 @@ class Context: 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 @@ -178,6 +178,9 @@ class Context: # 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()]) @@ -206,8 +209,8 @@ class Context: 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 @@ -216,7 +219,7 @@ class Context: 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) v = expression(self)