On Wed, 01 Feb 2006 09:07:17 +0100, "Andreas Jung" <[EMAIL PROTECTED]> said: > > > --On 1. Februar 2006 09:04:36 +0100 Frank Burkhardt <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > in Zope2 there's a test() method that can be used in TAL (*). Is there > > something comparable in Zope3? > > > > I know how to write such a method but how to make it available in the > > namespace of TALES-"python:"-expressions? I would like to write > > expressions like this: > > > > <div tal:attributes="class python: 'foo' + test(condition == True,' > > bar','')" /> > > > > You can write this in Python as > > condition and true_expression or false_expression
That doesn't work under some conditions: C and A or B where C is a boolean if C is false it evaluates to B if C is true it evaluates to A EXCEPT when bool(A) == false example: C and None or 7 ALWAYS evaluates to 7 However, the expression (B,A)[C] always works if C is a boolean I'm using that until Python 2.5 comes along. _______________________________________________ Zope3-users mailing list [email protected] http://mail.zope.org/mailman/listinfo/zope3-users
