[ZPT] Mini proposal: repeat-define and repeat-condition
Tom Deprez
tom@aragne.com
Mon, 27 Jan 2003 11:22:01 +0100
<snip>
> Hmm. I'm beginning to like the original proposal better. After all,
> while we would probably want to forbid the combination of old and new
> repeat statements on a tag, any combination of define, condition,
> repeat-define, and repeat-condition is sensible.
>
> Not only that, all five statements are quite likely to be useful on a
> single tag:
>
> <tr tal:define="items here/getItems"
> tal:condition="options/itemize"
> tal:repeat="item items"
> tal:repeat-define="name item/name;price item/price"
> tal:repeat-condition="python:name and price">
>
> How about calling them "define2" and "condition2" instead, and
> allowing them even in the absence of a tal:repeat? It's a little
> ugly, and could be taken to imply the existence of "condition3",
> etc., but would allow:
>
> <div tal:define="x here/getX"
> tal:condition="python:len(x) == 2"
> tal:define2="x0 python:x[0];x1 python:x[1]"
> tal:condition2="python:x0 < x1">
>
> The fact that they sandwich tal:repeat in the order of operations is
> sufficient rationale (for me) for having two sets without
> over-generalizing into "defineN" and "conditionN".
Mmm, why not using defineAfter, conditionAfter instead of define2?
Tom.