[ZPT] changing the order of operations
Jamie Heilman
jamie at audible.transient.net
Thu Jul 24 00:50:58 EDT 2003
Charlie Clark wrote:
> On 2003-07-23 at 22:35:12 [+0200], Jamie Heilman wrote:
> > I've mentioned it before and nobody commented on the idea, but I can't
> > think of a single good reason 'attributes' is executed before 'omit-tag.'
> > Switching them could yeild speed increases in the case where 'omit-tag'
> > is true and 'attributes' is expensive. Am I wrong? Why is this not a
> > good idea? When is it useful to generate attributes for a tag and then
> > throw away the work?
>
> Sounds more like a programming error to me. Why have tal:attributes and
> tal:omit-tag in the same tag at all?
You want to itterate over a set of items wrapping some in a tag with
attributes, and some not, based upon external criteria. Here's bad
example (isPrincipiaFolderish is sick, and <a> is probably not the
most useful tag), but a self-contained example at any rate:
<ul>
<li tal:repeat="o here/objectValues"><a
tal:define="name o/getId"
tal:content="string:>${name}<"
tal:attributes="href string:${o/absolute_url}/;id o/getId"
tal:omit-tag="not:o/isPrincipiaFolderish">objects</a></li>
</ul>
--
Jamie Heilman http://audible.transient.net/~jamie/
"...thats the metaphorical equivalent of flopping your wedding tackle
into a lion's mouth and flicking his lovespuds with a wet towel, pure
insanity..." -Rimmer
More information about the ZPT
mailing list