[ZPT] CVS: Releases/Zope/lib/python/TAL - DummyEngine.py:1.34 TALGenerator.py:1.58
Evan Simpson
evan@zope.com
Tue, 1 Oct 2002 11:52:57 -0400
Update of /cvs-repository/Releases/Zope/lib/python/TAL
In directory cvs.zope.org:/tmp/cvs-serv5702/lib/python/TAL
Modified Files:
DummyEngine.py TALGenerator.py
Log Message:
Fix Collector #539, and make DummyEngine work outside of Zope.
=== Releases/Zope/lib/python/TAL/DummyEngine.py 1.33 => 1.34 ===
--- Releases/Zope/lib/python/TAL/DummyEngine.py:1.33 Wed Sep 18 11:12:48 2002
+++ Releases/Zope/lib/python/TAL/DummyEngine.py Tue Oct 1 11:52:56 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.57 => 1.58 ===
--- Releases/Zope/lib/python/TAL/TALGenerator.py:1.57 Thu Sep 19 10:39:24 2002
+++ Releases/Zope/lib/python/TAL/TALGenerator.py Tue Oct 1 11:52:56 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: