[ZPT] CVS: Releases/Zope/lib/python/TAL - DummyEngine.py:1.32.6.4 TALGenerator.py:1.55.6.3

Evan Simpson evan@zope.com
Tue, 1 Oct 2002 11:54:27 -0400


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

Modified Files:
      Tag: Zope-2_6-branch
	DummyEngine.py TALGenerator.py 
Log Message:
Merge fix for Collector #539 from trunk.


=== Releases/Zope/lib/python/TAL/DummyEngine.py 1.32.6.3 => 1.32.6.4 ===
--- Releases/Zope/lib/python/TAL/DummyEngine.py:1.32.6.3	Fri Sep 20 15:52:25 2002
+++ Releases/Zope/lib/python/TAL/DummyEngine.py	Tue Oct  1 11:54:26 2002
@@ -21,11 +21,16 @@
 from TALDefs import NAME_RE, TALESError, ErrorInfo
 from ITALES import ITALESCompiler, ITALESEngine
 from DocumentTemplate.DT_Util import ustr
-try:
-    from Zope.I18n.ITranslationService import ITranslationService
-    from Zope.I18n.IDomain import IDomain
-except ImportError:
-    # Before 2.7
+
+IDomain = None
+if sys.modules.has_key('Zope'):
+    try:
+        from Zope.I18n.ITranslationService import ITranslationService
+        from Zope.I18n.IDomain import IDomain
+    except ImportError:
+        pass
+if IDomain is None:
+    # Before 2.7, or not in Zope
     class ITranslationService: pass
     class IDomain: pass
 


=== Releases/Zope/lib/python/TAL/TALGenerator.py 1.55.6.2 => 1.55.6.3 ===
--- Releases/Zope/lib/python/TAL/TALGenerator.py:1.55.6.2	Thu Sep 19 10:45:11 2002
+++ Releases/Zope/lib/python/TAL/TALGenerator.py	Tue Oct  1 11:54:26 2002
@@ -275,7 +275,7 @@
             else:
                 self.emit("setGlobal", name, cexpr)
 
-    def emitOnError(self, name, onError):
+    def emitOnError(self, name, onError, TALtag, isend):
         block = self.popProgram()
         key, expr = parseSubstitution(onError)
         cexpr = self.compileExpression(expr)
@@ -284,7 +284,10 @@
         else:
             assert key == "structure"
             self.emit("insertStructure", cexpr, {}, [])
-        self.emitEndTag(name)
+        if TALtag:
+            self.emitOptTag(name, (None, 1), isend)
+        else:
+            self.emitEndTag(name)
         handler = self.popProgram()
         self.emit("onError", block, handler)
 
@@ -599,7 +602,11 @@
             todo["scope"] = 1
         if onError:
             self.pushProgram() # handler
+            if TALtag:
+                self.pushProgram() # start
             self.emitStartTag(name, list(attrlist)) # Must copy attrlist!
+            if TALtag:
+                self.pushProgram() # start
             self.pushProgram() # block
             todo["onError"] = onError
         if define:
@@ -758,7 +765,7 @@
         if condition:
             self.emitCondition(condition)
         if onError:
-            self.emitOnError(name, onError)
+            self.emitOnError(name, onError, optTag and optTag[1], isend)
         if scope:
             self.emit("endScope")
         if i18ncontext: