[ZPT] Mini proposal: repeat-define and repeat-condition
Richard Jones
rjones@ekit-inc.com
Fri, 24 Jan 2003 22:29:05 +1100
On Fri, 24 Jan 2003 10:21 pm, Florent Guillaume wrote:
> 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>
>
> 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
I'm not sure about the change to "iter", but at least it does shorten the
attribute name. Perhaps we could come up with a suitable contraction, like
"repcond" and "repdef"?
Richard