[Zope] A ZPT newbie question
Clemens Robbenhaar
robbenhaar@espresto.com
Tue, 5 Nov 2002 14:08:42 +0100
Hi Wankyu Choi,
> Hi all,
>
> There must be a better way than:
>
> <span tal:omit-tag="" tal:condition="python: this_object is not
> None">
> <span tal:replace="python: this_object.getSomethingBig() " />
> </span>
>
"tal:condition" is evaluated before "tal:replace" (see Zope Book,
Appendix C, ZPT Reference), thus You should be able to save at least one
<span> by saying:
<span tal:condition="python: this_object is not None"
tal:replace="python: this_object.getSomethingBig() " />
> The following gives an attribute error if 'this_object' is None:
>
> <span tal:replace="python: test(this_object is not None,
> this_object.getSomethingBig(), '')" />
>
> test() seems to always evaluate both params no matter what.
[...]
Yes, "test" is a "normal" function, and no magic syntax; arguments are
always evaluated before the function "test" is evaluated.
Cheers,
Clemens