summaryrefslogtreecommitdiff
path: root/talinterpreter.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2004-07-13 19:19:55 +0000
committerFred Drake <fdrake@acm.org>2004-07-13 19:19:55 +0000
commit1e22536fa24e9f6bc379dca722afdea28f16aeb3 (patch)
treea6356963a69dd471e15234390fd52dfc912e82ad /talinterpreter.py
parentb04a97f8c654adedd00ec9da57658f8fc35d5bfa (diff)
downloadzope-tal-1e22536fa24e9f6bc379dca722afdea28f16aeb3.tar.gz
Fix for issue 233 in the Zope 3 collector.
This corresponds to the Hotfix_2004-07-13 product. (Merged from ZopeX3-3.0 branch revision 26504.)
Diffstat (limited to 'talinterpreter.py')
-rw-r--r--talinterpreter.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/talinterpreter.py b/talinterpreter.py
index ecec898..335c4d4 100644
--- a/talinterpreter.py
+++ b/talinterpreter.py
@@ -15,6 +15,7 @@
$Id$
"""
+import cgi
import sys
# Do not use cStringIO here! It's not unicode aware. :(
@@ -575,7 +576,7 @@ class TALInterpreter:
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.
@@ -593,13 +594,19 @@ class TALInterpreter:
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)
# evaluate() does not do any I18n, so we do it here.
if isinstance(value, MessageID):
# Translate this now.
value = self.engine.translate(value)
+ 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