[Zope-dev] ZPT and 'else'

Jeffrey P Shell jeffrey@cuemedia.com
Thu, 09 May 2002 22:47:42 -0600


On 5/9/02 9:39 PM, "Marc Lindahl" <marc@bowery.com> wrote:

> Yecch!
> 
> Why not:
> <if ...>
> True stuff
> </if>
> <else>
> False stuff
> </else>
> 
> If leaves around boolean result, else picks up the most recent one... It's
> like they push on a stack so you can nest them.... Something like that?

You would need something to close off the 'if' statement, otherwise, a
document full of 'if' statements and no 'else' ones could fill up a stack
needlessly.

You would at the very least need something like:
<condition>
 <if>...</if>
 <elif>...</elif>
 <else>...</else>
</condition>

Which would ensure / cut back on needless growth of stacks and/or global
variables.

Personally, I think the way Page Templates can do it (via a 'not'
expression) is fine.  When I used it today (and in the past), I never felt
myself missing 'else', because there's not really an 'if' to begin with.
Just conditions.  It keeps TAL light, and lets TALES take on the lifting of
how to write those conditions.

-- 
Jeffrey P Shell 
www.cuemedia.com