[Zope] The Honest Scoop on Zope

Martijn Pieters mj@antraciet.nl
Thu, 09 Sep 1999 16:14:26 +0200


At 15:20 09/09/99 , John Goerzen wrote:
>Martijn Pieters <mj@antraciet.nl> writes:
>
> > But nobody reads his mail properly =)
>
>I've always known that it takes someone from .nl to properly
>understand English :-)

I cheat. My wife is from Scotland.


> > He just said he had problems with these variables dissapearing.
> >
> > My answer:
> >
> > If your variables don't exist anymore in sub mthods, you didn't pass in 
> the
> > REQUEST object. Make sure that you call the method with REQUEST=REQUEST in
> > their call..
>
>OK, closer!  Here's the problem.  I have a method that returns an
>array of objects.  This works great with dtml-in.  I want to make a
>simple tree of these objects, so that when the person clicks on the +
>sign, the given object is displayed.  So, I set leaves to be the
>object's display method and branches_expr to call the function.  But
>-- this gives the object, but clicking + gives another listing of the
>same objects, and this keeps on going, presumably infinately.
>
>I tried passing tree-level to the function, but _ mysteriously is
>inaccessible inside dtml-tree.
>
>What exactly should I be doing?
>
>FWIW, I created a product and an Event class that holds information on
>events.  I then made a folder called eventDb that is populated with
>these types of objects.  In that folder's parent, there is a
>getEventsByDate method, that takes start and end dates, and returns a
>list of objects that fall in that range.  I then want to have a nice
>tree display of these objects.
>
>Thanks,
>
>John

Hmm.. the problem lies in the fact that the tree object tries to call your 
method on the Event objects as well (I know, you figured this one out). The 
best way to prevent this, is by defining the same method on your Event 
objects as well, having it return an empty list. This is exactly what 
SimpleItem.Item does (which DTML Methods and Documents inherit).

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------