Code

merged Zope Collector #372 fix from ZPT CVS trunk
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 10 Oct 2002 03:48:02 +0000 (03:48 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 10 Oct 2002 03:48:02 +0000 (03:48 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1330 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi/PageTemplates/PythonExpr.py
roundup/cgi/PageTemplates/TALES.py

index a8f06d516be4c943641806ba81ce772ff2d8d189..0bfe40034b35e3525a70bf8c4084bb54d8b79560 100644 (file)
@@ -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)
 
index d29e8a76f51d38024f428fa8d9fa49dd7a86e137..229064c79400243730bf00e90245906fba84e843 100644 (file)
@@ -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)