[Zope] Re: Doubt about the ZPT example in Using Zope Page Templates

Josef Meile jmeile@hotmail.com
Fri, 27 Jun 2003 20:10:36 +0200

> Ok I see.
> > using "python:item.title or default" or even cleaner, a
> > tales-statement: "item/title | default" just might help..
> I also think that the later is cleaner, but it doesn't work for
> me. I did:
> <td tal:content="item/title | default">No Title</td>
> But I got the same results when doing:
> <td tal:content="item/title">No Title</td>

Correct me if I'm wrong, but after thinking about it, I deducted that the
"or" in a tales-statement:
<td tal:content="item/title | default">No Title</td>

doesn't work like the "or" of python:
<td tal:content="python: item.title or default">

because for python the empty string is false while the tales-statement
returns true if the variable exist without caring about its value. I think
this should be fixed because the second solution adds unnecesary complexity
to the tal-expression and I also think that it's an inconsistency that one
works and the other don't.