[Zope] Fun with Trees

Dieter Maurer dieter@handshake.de
Mon, 3 Jul 2000 19:25:46 +0200 (CEST)


Charlie Wilkinson writes:
 > On Mon, Jul 03, 2000 at 09:35:06AM +0200, Rik Hoekstra waxed eloquent:
 > > 
 > > Charlie Wilkinson writes:
 > [...] 
 > > I'm trying to use dtml-tree to create a selective menu of objects based
 > > on whether or not the object has an "add_to_menu" property.
 > [...]
 > > [rh]
 > > - if you append sequence-item it will include your whole method, which
 > > presumably is not what you want in your tree. Use id.
 > 
 > Not sure.  Supposedly objectValues() returns "actual objects", and
 > I assumed that using sequence-item would be something closer to that.
 > <shrug>  The finer points of python are still lost on me, but I'm working
 > on it.
You are both right.

In principle, you can use "sequence-item" and get the object.
Later, when you use it, you can select whatever you need.

However, you used:
 <dtml-call "REQUEST.set('ret', ret + ' ' + _['sequence-item'])">

The "_[...]" calls "...", if this is callable.
Thus, "_['sequence-item']" first returns the object and then
calls it, if this is possible. In case of a DTML method, the
result would be the rendered body of the method.

You can use "_.getitem('sequence-item')" to get the object itself
and not the result of calling it.



Dieter