[Zope] Newbie dereferencing problem

Kirk Strauser kirk@strauser.com
16 Oct 2001 10:58:25 -0500


At 2001-10-16T15:10:22Z, "Trevor Toenjes" <zope@toenjes.com> writes:

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

I think that maybe I should have elaborated on my problem.  I have a
database with a column named 'imagename'.  Inside a <dtml-in> query, then,
imagename will be the name of a Zope object that may or may not exist.  If
the named object exists, then I want to perform one set of actions on the
object.  Otherwise, I want to perform another set of actions to create the
object.  Given the following database 'imagetable':

   ID  imagename
   --  ----------
   1   images/foo
   2   images/bar
   3   otherstuff/baz

and an SQL query method:

  getStuff:
    select * from imagetable

Then in this loop:

<dtml-in getStuff>
  <dtml-var imagename>
</dtml-in>

imagename will always exist, and it will always have a value (namely
'images/foo', 'images/bar', then 'otherstuff/baz').  I'm not interested in
checking whether imagename has a value - I want to see if the string stored
in imagename is a Zope object that exists.
-- 
Kirk Strauser