[Zope] Newbie dereferencing problem

Trevor Toenjes zope@toenjes.com
Tue, 16 Oct 2001 11:10:22 -0400


This is a newbie hack at the Q:
Maybe you can instantiate foo to a null variable in the REQUEST namespace
<dtml-call expr="REQUEST.set(foo,'')">
and then...later in your objects

<dtml-unless expr="foo == ''">
    <br>yep
</dtml-unless>

-Trevor

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Kirk
> Strauser
> Sent: Tuesday, October 16, 2001 10:04 AM
> To: zope@zope.org
> Subject: [Zope] Newbie dereferencing problem
>
>
> I apologize for the (probably FAQ) newbie problem.  FedEx hasn't delivered
> my copy of "The Zope Book" or "Programming Python" yet, so please forgive
> me.
>
> Suppose I have the name of an object in variable `foo'.  I would like to
> test for the existence of the named object.  Suppose that foo=='bar'.  The
> following won't work:
>
>   <dtml-if foo>
>     <br>Yep!
>   </dtml-if>
>
> because `foo' will always have a value.  How, then, can I see if `bar'
> exists?
>
> A million thanks,
> --
> Kirk Strauser
>
> _______________________________________________
> 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 )