OK, how about this:

1. Python is kept as is.
2. To support one-line if-else in attributes in ZPT, the python expressions used in ZPT imports an extra method. This method can be called whetever people want it toi be called, but for claritys sake lets call it 'if_else'

if_else(expression, true_result, false_result)


<img src="placeholder" tal:attributes="src if_else(has_icon, 'objectpath/icon', 'images/default_icon')">

Ok, then we can do if-then-else in one line for attributes of ZPT, without having to define a pythonscript that does it.

The method if_else would look like:

def if_else(c, a, b):
    if c:
        return a
        return b

I'm not expert in how python expression work, and hence don't know how to make python expressions aware about this method, but I'm sure it's possible, right?

Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to