[Zope3-dev] Re: a bug in the Zope 3 (and 2) page template engine
Martijn Faassen
faassen at startifact.com
Fri Apr 20 07:48:18 EDT 2007
Fred Drake wrote:
> On 4/20/07, kit BLAKE <kitblake at gmail.com> wrote:
>> 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.
>
> This is some pretty freaky behavior for page templates, I think, but
> was by design. (I don't remember the driving use-case though; sorry.)
>
> The problem is that Martijn's replacement doesn't start with an
> element, so the attribute insertion fails. There should probably be a
> more explanatory error message in this case.
No, I don't think that is the cause of the problem, unless I'm missing
something. This results in the exact same error:
<html>
<img tal:replace="structure python:'<p>Foo</p>'" tal:attributes="title
python:'bar'" />
</html>
The error message is not just non-explanatory. The error message is an
indication of a real bug that's been in Zope 3 page templates since SVN
history began. :)
> I don't really like this behavior, and wouldn't miss it if it were
> disallowed, but the current expectation is that it work when the
> replacement starts with an element.
No, the current expectation is that it works, whatever the replacement
is. This currently works in Zope 2.8:
<img tal:replace="structure python:'Foo'" tal:attributes="title
python:'bar'" />
The result is' foo'.
Regards,
Martijn
More information about the Zope3-dev
mailing list