Elena Schulz a écrit:
Hi,
I have the followong TAL-expression:
<td tal:content="structure python:here.test(myImportantCondition and myExpensiveMethod(), myExpensiveMethod(), 'myDefaultString')">myDefaultString</td>
use python:test(<your test>) instead of python:here.test(<your test>) --- -------
To execute 'myExpensiveMethod()' 'myImportantCondition' must be 'true'. But I want to avoid to execute 'myExpensiveMethod()' two times. How can I achive that? As default-value myDefaultString should be served.
I don't know a way with tal:condition 'cause on 'false' there is no way to get 'myDefaultString', isn't it?
tal:condition="not:(here/myImportantCondition() and here/myExpensiveMethod()" tal:define method here/myExpensiveMethod() Due to my lack of experience, i'm not sure that the use of the 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
-- many thanks for your replies, Elena
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Andre PZP Enthusiast