[Zope] Testing multiple values for existance - still

Oliver Sturm sturm@oliver-sturm.de
Tue, 25 Sep 2001 10:10:28 +0200


On 24.09.2001 21:26:28 +0200 Dieter Maurer <dieter@handshake.de> wrote:

> Apparently, you ignored my reply.....
> 
>      <dtml-if "(_.has_key('foo') and foo) or (_.has_key('bar') and bar)">

Sorry, it seems I did. And that's sad, because it's the only one that really
works out of the box. One question, though: After fiddling around a bit with
that line (still trying to understand things better :-), it seems that 

<dtml-if "(_.has_key('foo')) or (_.has_key('bar'))">

works the same. In what situation would there be a key in the global
namespace (that's the _, isn't it?), but the name is still not defined?

The whole thing still has one great question for me:

- How exactly is the expression "foo" defined? I mean, in C, the expression 
  "foo" is defined to be the same as "foo != 0", and that's true in all 
  circumstances. I can use "foo && bar" as a substitute for "(foo != 0) && 
  (bar != 0)". I still fail to see the consistency in the Python 
  expressions, because <dtml-if "foo and bar"> does not do the same thing as 
  <dtml-if foo><dtml-if bar>, at least not if foo and bar are not defined.

Thanks for your help!

Oliver

-- 
Oliver Sturm / <sturm@oliver-sturm.de>