[Zope3-dev] Weird TAL code path?

Fred Drake fdrake at gmail.com
Thu Oct 21 03:11:31 EDT 2004


On Thu, 21 Oct 2004 00:12:24 -0200, Sidnei da Silva <sidnei at awkly.org> wrote:
> I've got this error on a page template, and I'm not sure why. I don't
> see why it worked before, and it doesn't make much sense to me why
> this template is different than others. I can send the ZPT that caused
> this, though it has an intrincate set of dependencies, probably
> unreproducible with lots of work *wink*

Clearly the problem involves the insertion of structure.  ;-)  I'd
really like to get a test case for this; if you can manage the time to
cut down the templates that are involved and possibly write a
functional test, I'd love to get that from you.

After poking around in this code for a little bit, I'm convinced we
have some massive shortfalls in test coverage.  ;-(  This is a case
where the factoring of some of the existing implementation in the
zope.tal package isn't well-suited to testing, and actually fixing the
problem may require changing some of the plumbing.

What it boils down to is that the "engine" attribute of the
TALInterpreter is expected to be two different things: an
ITALExpressionCompiler (needed by the TALGenerator) and an
ITALExpressionEngine (an "evaluation context", needed by the
TALInterpreter).  The expression compiler is responsible for creating
the evaluation contexts, but there's no defined way to go from the
context to the compiler.  The zope.tal package provides a combined
compiler/context which implements both interfaces, but the "real"
compiler/context from zope.tales (or the derived compiler and context
from zope.app.pagetemplate) don't share that characteristic.  And they
shouldn't need to.

I've added some assertions in my sandbox that check the values at a
few key points to make sure the object passed to constructors
implements the right interface, but... they pass in the unit tests
because the DummyEngine implements both interfaces.  Poking at the ZMI
very briefly doesn't trigger them, but I'm betting structure insertion
isn't being used for what I poked at.  I expect they would trigger for
you.

I'm looking at the Zope 3 trunk; there's a patch attached.  Please
confirm that the assertions fail for you with the patch, and let me
know what it prints on stderr.  And I'd *really* like a decent
reproducible test case.  ;-)

Enough for now; I need sleep.


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zope-tal.patch
Type: text/x-patch
Size: 2136 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20041021/eac9192b/zope-tal.bin


More information about the Zope3-dev mailing list