Re: [Zope] Basic Template question : 'truthiness'
David H wrote: Mark Gibson wrote: I thought I knew how this stuff worked, but this has gotten me banging my head against a wall. I'm trying to evaluate a condition expression, and I'm not getting what I expect when using path, and I get a different result when using python. The following expressions results= dosearch=/> querytpe=/> TRUE IN PYTHON <-- This doesn't evaluate to true --> THIS DOESN'T SHOW UP Produces: results=[] dosearch=NO SEARCH querytpe=mps TRUE IN PYTHON As you can see, the second expression doesn't evaluate to True. Can someone explain the subtleties I seem to be missing? Thanks, Mark ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) __ NOD32 1.1592 (20060611) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com Mark, Just looking at your second example: <-- This doesn't evaluate to true --> THIS DOESN'T SHOW UP If you replace '| nothing' with '| default' you will get "THIS DOESNT SHOW UP" David Mark, Sorry I misread your problem. My last post! *Sorry* :-) David ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Basic Template question : 'truthiness'
Mark Gibson wrote: I thought I knew how this stuff worked, but this has gotten me banging my head against a wall. I'm trying to evaluate a condition expression, and I'm not getting what I expect when using path, and I get a different result when using python. The following expressions results= dosearch= querytpe=/> TRUE IN PYTHON <-- This doesn't evaluate to true --> THIS DOESN'T SHOW UP Produces: results=[] dosearch=NO SEARCH querytpe=mps TRUE IN PYTHON As you can see, the second expression doesn't evaluate to True. Can someone explain the subtleties I seem to be missing? Thanks, Mark ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) __ NOD32 1.1592 (20060611) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com Mark, Just looking at your second example: <-- This doesn't evaluate to true --> THIS DOESN'T SHOW UP If you replace '| nothing' with '| default' you will get "THIS DOESNT SHOW UP" David ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Basic Template question : 'truthiness'
--On 11. Juni 2006 13:35:40 -0600 Mark Gibson <[EMAIL PROTECTED]> wrote: <-- This doesn't evaluate to true --> THIS DOESN'T SHOW UP > 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 pgpyZMUT9pkDH.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )