[Zope3-dev] attr name space (was: RFC: abolishing python:
expressions)
Alexander Limi
limi at plone.org
Fri Dec 30 05:22:56 EST 2005
On Thu, 29 Dec 2005 15:49:46 +0100, Philipp von Weitershausen
<philipp at weitershausen.de> wrote:
> I think it would be quite possible to do explicit key or attribute
> lookup with TALES, e.g.:
>
> foo/attr:bar (for foo.bar)
> foo/key:bar (for foo['bar'])
> foo/item:1 (for foo[1])
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! :)
What do y'all think?
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. :)
--
_____________________________________________________________________
Alexander Limi · Chief Architect · Plone Solutions · Norway
Consulting · Training · Development · http://www.plonesolutions.com
_____________________________________________________________________
Plone Co-Founder · http://plone.org · Connecting Content
Plone Foundation · http://plone.org/foundation · Protecting Plone
More information about the Zope3-dev
mailing list