[Zope3-dev] Re: attr name space

Philipp von Weitershausen philipp at weitershausen.de
Fri Dec 30 07:39:40 EST 2005


Alexander Limi wrote:
> This reminds me of a thing Steve Alexander and myself talked about when 
> working together on a project using Zope 3 a while back:
> 
> One of the ugliest and most error-prone parts of TAL is its handling of 
> multiple attributes:
> 
> <a tal:attributes="href some/url;
>                    title some/title;" />
> 
> etc.
> 
> We looked at having a separate namespace for these kinds of statements. 
> The above code would then be:
> 
> <a attr:href="some/url"
>    attr:title="some/title" />
> 
> thus doing away with the need for semicolons and the "should the last
> line  have a semicolon or not" confusion.
> 
> The same would probably be relevant for tal:defines, something like:
> 
> <div define:mammals="here/getMammals"
>      define:fish="here/getFish"
> 
>  />
> 
> This provides the following benefits:
> 
> - Easier to parse for XML tools (no semicolons with any meaning)
> 
> - More consistent syntax, no need to learn a special way to separate 
> several attributes/defines
> 
> - It looks nice! :)

It's especially much easier to format with a lot less whitespace...

> What do y'all think?

+1

Steve presented me with that idea once too and I remember I had some
negative feelings about it. I don't remember what they were, though :).

I'd suggest that the namespace prefixes be talattr and taldefine just to
be clear on what they belong too. Of course, I'd prefer if ZPTs would
stop magically assuming certain namespace prefixes completely.

Btw, we also need this for i18n:attributes which I guess would become
i18nattr:<attr>.

> For the record, I'm also for getting rid of the python: stuff in TAL,
> but  only if we can solve the common use cases others have identified
> earlier  in this discussion. Making ZPT carry less smarts and
> preferrably get it a  bit faster would be very welcome in my universe. :)

I've tried to answer the three most important points of criticism in a
blog entry:
http://www.z3lab.org/sections/blogs/philipp-weitershausen/2005_12_29_rocky-vi-one-man-against

Philipp


More information about the Zope3-dev mailing list