[ZPT] If/else?

Evan Simpson evan@digicool.com
Thu, 10 May 2001 09:56:12 -0400


From: <richard@bizarsoftware.com.au>
> The definition of the '|' operator is missing a statement about the
> correctness of the path resolution. Guido's email stated '"x | y | z" will
> evaluate to the path x if it is defined and non-empty...' but the wiki
page
> only talks about evaluating to a 'true value'.

Got it.

> <div tal:condition="python:exists('a/b/c')"
>      tal:replace="a/b/c/d" />
>
> ... and
>
> <div tal:replace="a/b/c/d | nothing" />
>
> ... apear to achieve the same result. Could this spell the death of
> tal:condition?

Not at all.  Consider <div tal:condition="python:here.rows > 2">

> ... the wiki page says that path() will return an error object if the path
> doesn't resolve. What will the result of "<error object> + 1" be?

Any operation on an error object will raise an exception.

Cheers,

Evan @ digicool