[ZPT] CVS: Zope3/lib/python/Zope/TAL - TALInterpreter.py:1.63.10.3.4.2

Barry Warsaw barry@wooz.org
Tue, 4 Jun 2002 12:46:50 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/TAL
In directory cvs.zope.org:/tmp/cvs-serv10445

Modified Files:
      Tag: fdrake-tal-i18n-branch
	TALInterpreter.py 
Log Message:
attrAction(), attrAction_tal(): Get rid of the numeric actions.
Instead, use the action names that are now included in the
intermediate code.  Makes for easier debugging.


=== Zope3/lib/python/Zope/TAL/TALInterpreter.py 1.63.10.3.4.1 => 1.63.10.3.4.2 ===
     def attrAction(self, item):
         name, value, action = item[:3]
-        if action == 1 or (action > 1 and not self.showtal):
+        if action == 'insert' or (action in ('metal', 'tal', 'xmlns')
+                                  and not self.showtal):
             return 0, name, value
         macs = self.macroStack
-        if action == 2 and self.metal and macs:
+        if action == 'metal' and self.metal and macs:
             if len(macs) > 1 or not macs[-1][2]:
                 # Drop all METAL attributes at a use-depth above one.
                 return 0, name, value
@@ -288,14 +289,14 @@
 
     def attrAction_tal(self, item):
         name, value, action = item[:3]
-        if action > 1:
+        if action in ('metal', 'tal', 'xmlns'):
             return self.attrAction(item)
         ok = 1
         expr, xlat = item[3:]
         if self.html and name.lower() in BOOLEAN_HTML_ATTRS:
             evalue = self.engine.evaluateBoolean(item[3])
             if evalue is self.Default:
-                if action == 1: # Cancelled insert
+                if action == 'insert': # Cancelled insert
                     ok = 0
             elif evalue:
                 value = None
@@ -305,7 +306,7 @@
             if expr is not None:
                 evalue = self.engine.evaluateText(item[3])
                 if evalue is self.Default:
-                    if action == 1: # Cancelled insert
+                    if action == 'insert': # Cancelled insert
                         ok = 0
                 else:
                     if evalue is None: