[ZPT] Mini proposal: repeat-define and repeat-condition

Florent Guillaume fg@nuxeo.com
Fri, 24 Jan 2003 11:21:28 +0000 (UTC)


Shane Hathaway  <shane@zope.com> wrote:
> Add two new TAL attributes, "repeat-define" and "repeat-condition". 
> These have the same semantics as "define" and "condition", respectively, 
>   but when combined with a "repeat" attribute, they get executed once 
> per loop iteration.  I would be able to rewrite the above example like this:
> 
> <tr tal:repeat="item here/objectItems"
>      tal:repeat-define="key python: item[0]; value python: item[1]"
>      tal:repeat-condition="python: value.date < expiration">
>   <td>...</td>
>   <td>...</td>
> </tr>
> 
> What do you think?

I like that.

For the record, I'm completely against changing the order of the
existing define/condition vs repeat attributes at this late stage.
Besides, the current order *is* also useful.

I'm also against letting the user chose a different order if there's
some magic in the file or elsewehere. The order should be set in stone,
otherwise it's hell to debug and document things, and help users.

To continue on Shane's suggestion, I'd propose to use the iter- prefix
instead of repeat-.

So I propose:

1. define
2. condition
3. repeat
    a. iter-define
    b. iter-condition
4. content or replace
5. attributes
6. omit-tag

Florent
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com