[Zope3-checkins] CVS: Zope3/src/zope/tal - dummyengine.py:1.11.18.2 talinterpreter.py:1.22.4.2

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Aug 8 12:58:43 EDT 2003


Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv16409/src/zope/tal

Modified Files:
      Tag: srichter-i18n-macro-interaction-branch
	dummyengine.py talinterpreter.py 
Log Message:
Updated the DummyEngine to handle MessageIDs, but now I really dug up a 
rabbit hole; I found another case that is failing.


=== Zope3/src/zope/tal/dummyengine.py 1.11.18.1 => 1.11.18.2 ===
--- Zope3/src/zope/tal/dummyengine.py:1.11.18.1	Fri Aug  8 10:41:00 2003
+++ Zope3/src/zope/tal/dummyengine.py	Fri Aug  8 11:58:08 2003
@@ -89,6 +89,7 @@
         else:
             type = "path"
             expr = expression
+
         if type in ("string", "str"):
             return expr
         if type in ("path", "var", "global", "local"):
@@ -129,6 +130,8 @@
 
     def evaluateText(self, expr):
         text = self.evaluate(expr)
+        if isinstance(text, (str, unicode, MessageID)):
+            return text
         if text is not None and text is not Default:
             text = str(text)
         return text
@@ -229,6 +232,10 @@
         # If the domain is a string method, then transform the string
         # by calling that method.
 
+        print '*'*70
+        print msgid
+        print mapping
+        print '*'*70
         # MessageID attributes override arguments
         if isinstance(msgid, MessageID):
             domain = msgid.domain


=== Zope3/src/zope/tal/talinterpreter.py 1.22.4.1 => 1.22.4.2 ===
--- Zope3/src/zope/tal/talinterpreter.py:1.22.4.1	Tue Aug  5 18:41:48 2003
+++ Zope3/src/zope/tal/talinterpreter.py	Fri Aug  8 11:58:08 2003
@@ -14,7 +14,6 @@
 """
 Interpreter for a pre-compiled TAL program.
 """
-
 import sys
 
 # Do not use cStringIO here!  It's not unicode aware. :(
@@ -68,7 +67,7 @@
 
     def emit(self, *args):
         if self.enabled:
-            apply(TALGenerator.emit, (self,) + args)
+            TALGenerator.emit(self, *args)
 
     def emitStartElement(self, name, attrlist, taldict, metaldict, i18ndict,
                          position=(None, None), isend=0):
@@ -155,22 +154,7 @@
         self.macroStack.append([macroName, slots, entering, self.i18nContext])
 
     def popMacro(self):
-        stuff = self.macroStack.pop()
-        # XXX: Fred check this, please! But it makes totally sense. In
-        # pushMacro() you never make any adjustment to self.i18nContext, but
-        # when you pop the macro you do set self.i18nContext. That cannot be
-        # correct! And commenting the line below out, makes all the tests pass!
-        #self.i18nContext = stuff[3]
-        return stuff
-
-    def macroContext(self, what):
-        macroStack = self.macroStack
-        i = len(macroStack)
-        while i > 0:
-            i = i-1
-            if macroStack[i][0] == what:
-                return i
-        return -1
+        return self.macroStack.pop()
 
     def __call__(self):
         assert self.level == 0
@@ -391,14 +375,6 @@
         else:
             self.do_optTag(stuff)
     bytecode_handlers["optTag"] = do_optTag
-
-    def dumpMacroStack(self, prefix, suffix, value):
-        sys.stderr.write("+---- %s%s = %s\n" % (prefix, suffix, value))
-        for i in range(len(self.macroStack)):
-            what, macroName, slots = self.macroStack[i][:3]
-            sys.stderr.write("| %2d. %-12s %-12s %s\n" %
-                             (i, what, macroName, slots and slots.keys()))
-        sys.stderr.write("+--------------------------------------\n")
 
     def do_rawtextBeginScope(self, (s, col, position, closeprev, dict)):
         self._stream_write(s)




More information about the Zope3-Checkins mailing list