On Fri, 2002-05-10 at 12:21, Jim Penny wrote:
> On Fri, May 10, 2002 at 11:53:47AM +0100, Chris Withers wrote:
> > [...]
> Actually, the first time I got bit was on repeat v. condition.  I wanted
> the condition to test each row, not to guard the entire iteration
> process.

You shouldn't want that. If you want a condition applied to each item of
a sequence to decide if you want to display it or not, then you are
filtering the sequence, and filtering sequences has no place in a
templating language.

What you should want is to have a python script or a tal:define (which
evaluates before tal:repeat) to provide the filtered sequence. Filtering
elements out of a sequence is coding, and a presentation language should
not be messing with that.

And no, putting a <tal:x tal:condition...> block enclosed imediatelly
inside a <tal:x tal:repeat> is not an acceptable solution, because
you'll be generating useless whitespace for every instance of the repeat
that is not selected by your condition. I still have painful memories of
a situation where some pages served by a Zope instance in one client
where excruciatingly slow. It turned out to be the pages themselves,
which where huge, and contained mostly whitespace. And the reason they
where huge was because they contained 3 <dtml-in>s with <dtml-if>s to
the same HUGE sequence (a sql query, IIRC), with <dtml-in>s in them,
each time selecting just a few of the elements.

Cheers, Leo

Ideas don't stay in some minds very long because they don't like
solitary confinement.

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to