[Zope] Newbie dereferencing problem

Casey Duncan c.duncan@nlada.org
Tue, 16 Oct 2001 11:53:10 -0400

On Tuesday 16 October 2001 10:04 am, Kirk Strauser allegedly wrote:
> 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,


<dtml-if expr="_.has_key(foo)">
  there is an object named <dtml-var name="foo">!

  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association