[Zope] Testing multiple values for existance

Laurie Nason laurien@blake.3dem.bioch.bcm.tmc.edu
Thu, 20 Sep 2001 14:00:41 -0500


What I do is use either:
<dtml-unless foo>
   Do something as it doesn't exist
</dtml-unless

OR 

<dtml-if name="foo">
   foo exists
<dtml-else>
   foo doesn't exist
</dtml-if>

hth 
Laurie

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Oliver Sturm
Sent: Thursday, September 20, 2001 1:30 PM
To: zope@zope.org
Subject: Re: [Zope] Testing multiple values for existance



>> 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

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )