[Zope] Fun with Trees

Charlie Wilkinson cwilkins@boinklabs.com
Sun, 2 Jul 2000 04:28:55 -0400


(I always wanted to be a lumberjack! :)

After RTFMing and flailing at DTML all night, I'm about stumped.
No pun intended.

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.  I've pretty
much figured out that I need a wrapper around objectValues that will
filter out the objects that don't have the "add_to_menu" property.
This wrapper would be called with dtml-tree's "branches" attribute.
I'm trying to do this wrapper in a DTML method and I've gotten all the
way to where I have to return a list of "actual objects", so says the
DTML Quick Reference.

Is there someone who could 'splain to me how to build a list of objects
in DTMLese?

Here's what I have so far (obviously not working):

<dtml-call "REQUEST.set('ret', '')">
<dtml-in "objectValues()" sort=id>
    <dtml-if "_.has_key('add_to_menu')">
      <dtml-call "REQUEST.set('ret', ret + ' ' + _['sequence-item'])">
    </dtml-if>
</dtml-in>
<dtml-return "_.string.split(ret)">

Right off the bat, Zope is giving me attribute errors about REQUEST,
but I'm not sure how else to do a set(), other than with REQUEST or
RESPONSE in front of it.

When I ran it stand-alone, I was *not* getting attribute errors and *was*
getting output that looked remotely like the guts of the desired objects.

Spare clues anyone?

TIA,
	Charlie

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Charlie Wilkinson - cwilkins@boinklabs.com - N3HAZ
Parental Unit, UNIX Admin, Homebrewer, Cat Lover, Spam Fighter, HAM, SWLer...
    Visit the Radio For Peace International Website: http://www.rfpi.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            CLOBBER INTERNET SPAM:  See!! <http://spam.abuse.net/>        
                                   Join!! <http://www.cauce.org/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
QOTD:
Failure is not an option. It's bundled with your software.