[Zope] TAL: test() or condition Howto?
D2
borelan@wanadoo.fr
Fri, 31 Jan 2003 08:30:53 -0400
Elena Schulz a =E9crit:
> Hi,
>=20
> I have the followong TAL-expression:
>=20
> <td
> tal:content=3D"structure python:here.test(myImportantCondition and
> myExpensiveMethod(), myExpensiveMethod(),
> 'myDefaultString')">myDefaultString</td>
use python:test(<your test>) instead of python:here.test(<your test>)
--- -------
>=20
> To execute 'myExpensiveMethod()' 'myImportantCondition' must be 'true'.=
But
> I want to avoid to execute 'myExpensiveMethod()' two times. How can I a=
chive
> that? As default-value myDefaultString should be served.
>=20
> I don't know a way with tal:condition 'cause on 'false' there is no way=
to
> get 'myDefaultString', isn't it?
tal:condition=3D"not:(here/myImportantCondition() and=20
here/myExpensiveMethod()"
tal:define method here/myExpensiveMethod()
Due to my lack of experience, i'm not sure that the use of the=20
parenthesis in myImportantCondition() and ...Method() is correct.
Have a look at Page templates and TALES expressions in the zope book
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition
HTH
>=20
> -- many thanks for your replies, Elena
>=20
>=20
>=20
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -=20
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>=20
--=20
Andre
PZP Enthusiast