[Zope] TAL: test() or condition Howto?

Dieter Maurer dieter@handshake.de
Fri, 31 Jan 2003 21:29:47 +0100


Elena Schulz wrote at 2003-1-31 12:12 +0100:
 > I have the followong TAL-expression:
 > 
 >     <td
 >     tal:content="structure python:here.test(myImportantCondition and
 > myExpensiveMethod(), myExpensiveMethod(),
 > 'myDefaultString')">myDefaultString</td>
The safe way looks like:

    <... tal:define="myRes python:myCond and myMethod()"
         tal:content="python:test(myCond,myRes,default)"
	 ...

When you know that "myMethod()" cannot return a Python false
value, you can use

         ...
	 tal:content="python myCond and myMethod() or default"
	 ...


Dieter