[Zope] Testing multiple values for existance

Oliver Sturm sturm@oliver-sturm.de
Thu, 20 Sep 2001 20:29:32 +0200


>> I can do <dtml-if foo> to test if foo is known at all. Why can't I do
>> <dtml-if "foo or bar"> to test if either foo or bar are known? I get a
>> "Name Error" saying something like "global name 'foo' is not defined" if
>> I do this (and foo is actually undefined). Is there a different syntax
>> for this?

On 20.09.2001 14:10:35 -0400 marc lindahl <marc@bowery.com> wrote:

> Try testing for existence first -- hasattr()

On 20.09.2001 13:15:11 -0500 Steve Drees <drees@rangebroadband.com> wrote:

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

Thanks to both of you! Why is it a key once and an attr the other time?

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

-- 
Key ID: 71D86996
Fingerprint: 8085 5C52 60B8 EFBD DAD0  78B8 CE7F 38D7 71D8 6996