I fiddled a bit with TAL, METAL and TALES without page templates, using
TALGenerator (from zope.tal.talgenerator) and TALInterpreter (from
zope.tal.talinterpreter) directly. Something puzzles me about the engine
related parameter the __init__ method of either expects.

A TALGenerator expects an ExpressionEngine instance as the
expressionCompiler parameter. ExpressionEngine comes from zope.tales.tales
and is instantiated and configured through Engine from zope.tales.engine.

A TALInterpreter expects a Context (from zope.tales.tales) as the engine
parameter. A comment in TALInterpreter's __init__ code suggests that
"engine" and "context" are used synonymously.

However, in TALInterpreter.insertHTMLStructure, an AltTALGenerator (from
zope.tal.talinterpreter) is instantiated, its __init__ method expecting an
ExpressionEngine but being passed the Context instance in self.engine.

This leads to an AttributeError when using a TALInterpreter with
strictinsert=1 (which is the default) on a TAL program that contains a
structure expression. Page templates apparently avoid this by setting

What happens is that with strict checking
TALInterpreter.insertHTMLStructure is run and calls
AltTALGenerator.__init__ which calls TALGenerator.__init__ which accesses
expressionCompiler.getCompilerError(). A Context instance doesn't have
such a method, though.

What would be a reasonable fix for this?


Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to