[Zope] Basic Template question : 'truthiness'

Andreas Jung lists at zopyx.com
Sun Jun 11 15:48:25 EDT 2006



--On 11. Juni 2006 13:35:40 -0600 Mark Gibson <mark at dimensional.com> wrote:


>
> <-- This doesn't evaluate to true -->
> <div tal:condition="results | request/dosearch | request/querytype |
> nothing">THIS DOESN'T SHOW UP</div>
>
> >
>
> As you can see, the second expression doesn't evaluate to True.  Can
> someone explain the subtleties I seem to be missing?
>

The '|' inside a path expression is *not* a logical OR. Subsequent path 
expression will only be evaluated in case an earlier expression raised a 
KeyError or AttributeError(possibly only KeyError...you have to check the 
docs). Since 'results' evaluates perfectly without exceptionno other path 
expression is evaluted. This is documented more or less perfecly  in the 
Zope Book (ZPT reference I think).

-aj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20060611/94c8c92e/attachment.bin


More information about the Zope mailing list