[ZPT] OR

Geir Bækholt Geir Bækholt <geirh@funcom.com>
Fri, 7 Dec 2001 08:40:19 +0100


on or about, Friday, December 07, 2001, we have reason to believe that
alex wrote something along the lines of :
a> I was wondering how the `|' operand works
a> does | just evaluates None as false =3F
a> what about empty strings like '' =3F
a> I basically want:
a> <td tal:content=3D"item/foo | default">&nbsp;</td>
a> but if foo=3D'' then '' is printed instead of &nbsp;
a> why doesn't it work as the DTML's or =3F

I guess you mean python's or , often used in python expressions in
DTML. You can use python expressions in zpt as well, like this:

tal:content=3D"python:item.foo or default"
, but this will raise an error if item.foo does not exist at all.

TALES seem to evaluate whether an object exists, and not whether it is
'true' in a python sense, at least for strings. Can someone with more
insight in the workings of the ZPT engine please comment on whether it
does truth evaluation on other objects (ints and sequences for
example) =3F


--=20
Geir B=E6kholt                      web-developer
geirh@funcom.com             funcom oslo | webdev-team