[Zope] conditional python expresion inside ZPT

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Tue Dec 5 05:27:55 EST 2006


> if (my_expresion):
>     toreturn = a
> else:
>     toreturn = b
>
> return toretun
Try:
tal:define="toreturn python: my_expression and a or b"

but you need to be aware that 'a' has to be logical True
in context of this statement (if a may be 0 or '' then this
may fail).

or
tal:define="toreturn python: test(my_expression,a, b)"

-- 
Maciej Wisniowski


More information about the Zope mailing list