[Zope3-dev] Re: a bug in the Zope 3 (and 2) page template engine

Martijn Faassen faassen at startifact.com
Fri Apr 20 07:42:25 EDT 2007


kit BLAKE wrote:
> 2007/4/19, Martijn Faassen <faassen at startifact.com>:
>> Hi there,
>>
>> I just tracked down what I believe is a bug in the Zope 3 page template
>> engine. I didn't know it was a bug in the Zope 3 page template engine as
>> I was tracking down a bug in Silva with Zope 2.10, which of course uses
>> the Zope 3 page template engine. For the proposed solution, see the
>> bottom of the mail.
>>
>> Let's consider the following code fragment:
>>
>> <img tal:replace="structure python:'foo'" tal:attributes="title
>> python:'bar'" />
>>
>> In Zope 2 before Zope 2.10, this line works without error. The
>> tal:attributes line of course is pretty useless, as the whole img tag
>> gets replaced anyway, but it doesn't bail out with an error.
> 
> But those attributes *do* work. If you call that image without the
> attributes, it won't have a title attribute. If you keep the tag as it
> is, it will have a title attribute.

You are right, I just verified this. I was wondering about this 
yesterday, but in some cases I went through in Silva seemed to have a 
duplication only - the underlying Python code appeared to be doing the 
same as the ZPT, so the ZPT was redundant. I may have missed some cases 
though and I should've checked with an older version of Silva.

[snip]
>> This might also be a good occasion for a new Zope 2.10 bugfix release.
>> Silva is running into this currently, though of course now that we know
>> what the cause is we can work around it.
> 
> Just please keep the attributes working with replace :-)

Yes, definitely. I hope the fix I am proposing still does this, but I 
need to verify this. I will add a test that actually tests this.

Regards,

Martijn



More information about the Zope3-dev mailing list