[Zope-Checkins] CVS: Packages/TAL - TALDefs.py:1.36.4.1 TALGenerator.py:1.63.4.7 TALInterpreter.py:1.78.4.6

Fred L. Drake, Jr. fred at zope.com
Tue Jul 13 14:15:35 EDT 2004


Update of /cvs-repository/Packages/TAL
In directory cvs.zope.org:/tmp/cvs-serv15306/lib/python/TAL

Modified Files:
      Tag: Zope-2_7-branch
	TALDefs.py TALGenerator.py TALInterpreter.py 
Log Message:
Fix for issue 233 in the Zope 3 collector.
This corresponds to the Hotfix_2004-07-13 product.


=== Packages/TAL/TALDefs.py 1.36 => 1.36.4.1 ===
--- Packages/TAL/TALDefs.py:1.36	Mon Apr  7 13:38:27 2003
+++ Packages/TAL/TALDefs.py	Tue Jul 13 14:15:05 2004
@@ -19,7 +19,7 @@
 
 from ITALES import ITALESErrorInfo
 
-TAL_VERSION = "1.4"
+TAL_VERSION = "1.5"
 
 XML_NS = "http://www.w3.org/XML/1998/namespace" # URI for XML namespace
 XMLNS_NS = "http://www.w3.org/2000/xmlns/" # URI for XML NS declarations


=== Packages/TAL/TALGenerator.py 1.63.4.6 => 1.63.4.7 ===
--- Packages/TAL/TALGenerator.py:1.63.4.6	Sun Sep 14 10:59:15 2003
+++ Packages/TAL/TALGenerator.py	Tue Jul 13 14:15:05 2004
@@ -352,9 +352,8 @@
             assert action == I18N_EXPRESSION
             key, expr = parseSubstitution(expression)
             cexpr = self.compileExpression(expr)
-        # XXX Would key be anything but 'text' or None?
-        assert key in ('text', None)
-        self.emit('i18nVariable', varname, program, cexpr)
+        self.emit('i18nVariable',
+                  varname, program, cexpr, int(key == "structure"))
 
     def emitTranslation(self, msgid, i18ndata):
         program = self.popProgram()
@@ -784,7 +783,8 @@
             #   - I18N_CONTENT for tal:content
             #   - I18N_EXPRESSION for explicit tal:replace
             # o varname[2] will be None for the first two actions and the
-            #   replacement tal expression for the third action.
+            #   replacement tal expression for the third action.  This
+            #   can include a 'text' or 'structure' indicator.
             assert (varname[1]
                     in [I18N_REPLACE, I18N_CONTENT, I18N_EXPRESSION])
             self.emitI18nVariable(varname)


=== Packages/TAL/TALInterpreter.py 1.78.4.5 => 1.78.4.6 ===
--- Packages/TAL/TALInterpreter.py:1.78.4.5	Thu Dec 11 12:25:37 2003
+++ Packages/TAL/TALInterpreter.py	Tue Jul 13 14:15:05 2004
@@ -14,7 +14,7 @@
 """
 Interpreter for a pre-compiled TAL program.
 """
-
+import cgi
 import sys
 import getopt
 import re
@@ -496,7 +496,7 @@
     bytecode_handlers["insertText"] = do_insertText
 
     def do_i18nVariable(self, stuff):
-        varname, program, expression = stuff
+        varname, program, expression, structure = stuff
         if expression is None:
             # The value is implicitly the contents of this tag, so we have to
             # evaluate the mini-program to get the value of the variable.
@@ -510,7 +510,14 @@
         else:
             # Evaluate the value to be associated with the variable in the
             # i18n interpolation dictionary.
-            value = self.engine.evaluate(expression)
+            if structure:
+                value = self.engine.evaluateStructure(expression)
+            else:
+                value = self.engine.evaluate(expression)
+
+            if not structure:
+                value = cgi.escape(str(value))
+
         # Either the i18n:name tag is nested inside an i18n:translate in which
         # case the last item on the stack has the i18n dictionary and string
         # representation, or the i18n:name and i18n:translate attributes are



More information about the Zope-Checkins mailing list