[ZPT] CVS: Packages/TAL - DummyEngine.py:1.23 TALInterpreter.py:1.40

evan@serenade.digicool.com evan@serenade.digicool.com
Tue, 15 May 2001 12:09:03 -0400


Update of /cvs-repository/Packages/TAL
In directory serenade:/home/evan/Zope/pt/lib/python/TAL

Modified Files:
	DummyEngine.py TALInterpreter.py 
Log Message:
Change CancelAction to Default and eliminate inserted attribute turds.



--- Updated File DummyEngine.py in package Packages/TAL --
--- DummyEngine.py	2001/04/27 18:12:16	1.22
+++ DummyEngine.py	2001/05/15 16:09:02	1.23
@@ -92,7 +92,7 @@
 
 from TALDefs import NAME_RE, TALError, TALESError
 
-CancelAction = []
+Default = []
 
 class DummyEngine:
 
@@ -122,12 +122,10 @@
         if self.locals is self.stack[-1]:
             # Unmerge this scope's locals from previous scope of first set
             self.locals = self.locals.copy()
-        if value is not CancelAction:
             self.locals[name] = value
 
     def setGlobal(self, name, value):
-        if value is not CancelAction:
-            self.globals[name] = value
+        self.globals[name] = value
 
     def evaluate(self, expression):
         expression = self.uncompile(expression)
@@ -225,8 +223,8 @@
     def getTALESError(self):
         return TALESError
 
-    def getCancelAction(self):
-        return CancelAction
+    def getDefault(self):
+        return Default
 
 class Iterator:
 

--- Updated File TALInterpreter.py in package Packages/TAL --
--- TALInterpreter.py	2001/04/27 18:43:36	1.39
+++ TALInterpreter.py	2001/05/15 16:09:02	1.40
@@ -157,7 +157,7 @@
         self.macros = macros
         self.engine = engine
         self.TALESError = engine.getTALESError()
-        self.CancelAction = engine.getCancelAction()
+        self.Default = engine.getDefault()
         self.stream = stream or sys.stdout
         self.debug = debug
         self.wrap = wrap
@@ -265,7 +265,7 @@
                 if action <= 1 and self.tal:
                     if self.html and string.lower(name) in BOOLEAN_HTML_ATTRS:
                         evalue = self.engine.evaluateBoolean(item[3])
-                        if evalue is self.CancelAction:
+                        if evalue is self.Default:
                             if action == 1: # Cancelled insert
                                 continue
                         elif not evalue:
@@ -274,7 +274,7 @@
                             value = None
                     else:
                         evalue = self.engine.evaluateText(item[3])
-                        if evalue is self.CancelAction:
+                        if evalue is self.Default:
                             if action == 1: # Cancelled insert
                                 continue
                         else:
@@ -285,6 +285,8 @@
                       name[-13:] == ":define-macro" and self.metal):
                     name = name[:-13] + ":use-macro"
                     value = self.currentMacro
+                elif action == 1:
+                    continue # Unexecuted insert
             if value is None:
                 s = name
             else:
@@ -327,7 +329,7 @@
         text = self.engine.evaluateText(expr)
         if text is None:
             return
-        if text is self.CancelAction:
+        if text is self.Default:
             self.interpret(block)
             return
         text = cgi.escape(text)
@@ -340,7 +342,7 @@
         structure = self.engine.evaluateStructure(expr)
         if structure is None:
             return
-        if structure is self.CancelAction:
+        if structure is self.Default:
             self.interpret(block)
             return
         text = str(structure)
@@ -397,7 +399,7 @@
             self.interpret(block)
             return
         macro = self.engine.evaluateMacro(macroExpr)
-        if macro is self.CancelAction:
+        if macro is self.Default:
             self.interpret(block)
             return
         if not isCurrentVersion(macro):