[Zope] dtml-tree bugs?

Sam Gendler sgendler@impossible.com
Tue, 21 Dec 1999 15:21:22 -0800


From playing around with dtml-tree tags, it would appear that there are some
small bugs.  I had problems using branches-expr.  The namespace inside the tree
tag was not from the object in the tree, but from the object containing the
tree.  Writing code in python that called objectValues, and then calling that
from the branches= attribute of the tree tag fixed that one.  However, I have
another similar problem.  Each object in the tree (a zclass called Cpi),
contains a dtml-method called outline-string that returns a string.  This method
works fine when called directly from the containing object.  However, when my
tree is iterating through all of the Cpi objects, calls inside the tree tag to
the outline_string method always result in the outline_string tag from the CPI
containing the dtml-tree rather than the Cpi's contained by the tree (each Cpi
contains other Cpis)

The dtml-tree code is as follows:
<dtml-tree branches=cpiBranches>
<a href="<dtml-var absolute_url>/web_script">&nbsp;<dtml-var
outline_string>&nbsp;<dtml-var title_or_id></a>
</dtml-tree>

absolute_url and title_or_id render correctly for the class, but outline_string
always renders from the class containing this code.  I assume that the namespace
doesn't grab dtml-methods correctly.

While I am at it...  How do I access the PARENTS object of a ZClass from inside
python code?  My ZClass uses code that is almost identical to the ZDiscussion
Base Classes for base classes, and then has 2 ZClasses (equivalent to Topic and
Item in ZDiscussions) based on the python code.  I suspect the tree code would
work if I called a python method instead of a dtml one, but I have no idea how
to access the PARENTS object from within the code.  I was unable to reference it
as self.PARENTS or to pass it to the function.
\

--sam