[Zope] dtml-tree name

Dieter Maurer dieter@handshake.de
Mon, 22 Apr 2002 22:14:49 +0200


Marie ROBICHON writes:
 > I would like to define the name attribute of the dtml-tree widget with a 
 > string returned by a script (called treename) but I'm not sure of the syntax.
 > 
 > <dtml-tree expr="<dtml-var treename>" branches="tpValues"> doesn't work nor 
 > does
 > <dtml-tree name="<dtml-var treename>" branches="tpValues"> nor
 > <dtml-tree treename branches="tpValues">
"dtml-tree" needs an object not an object name.

When I last looked (a long time ago), it did not accept the
"expr" attribute.

You can try:

    <dtml-let
       treename=treename
       treeobject="_.getitem(treename)"
    >
      <dtml-tree treeobject ...>
        ...
      </dtml-tree>
    </dtml-let>

The "treename=treename" calls the script and binds its result
(a string as you say) to "treename". The 'treeobject="_getitem(treename)"'
resolves the string into an object and binds it to "treeobject".


Dieter