[Zope] Trees with DTML Methods?

Art Hampton arth@pacsg.css.mot.com
Fri, 10 Mar 2000 14:08:12 -0600


http://www.zope.org/Members/anthony/tree-coding-tricks
"How-To: Some Neat Tricks with dtml-tree"
seems to imply that I can use trees on things other than ZODB objects.

But I've been banging my head against the wall on this for some time,
and I can't figure it out.

Here's what I've got:

An index_html document:
<dtml-var standard_html_header>
<dtml-call "REQUEST.set('eid', '1000')">
<dtml-tree id=eid branches_expr="GetEmployees(eid=eid)">
  <dtml-var eid>
</dtml-tree>
<dtml-var standard_html_footer>


A DTML Method called GetEmployees that returns test data:
<dtml-if "eid == '1000'">
  <dtml-return "[1001, 1010]">
</dtml-if>
<dtml-if "eid == '1001'">
  <dtml-return "[1002, 1003]">
</dtml-if>
<dtml-if "eid == '1010'">
  <dtml-return "[1011, 1012]">
</dtml-if>
<dtml-return "[]">


What I get is an infinitely expanding tree of two pairs of 1000's:

- 1000
    + 1000
    - 1000
        + 1000
        - 1000
            + 1000
            + 1000
+ 1000

What I don't understand is how the stuff from branches_expr is supposed
to change things around.  And, not coincidentally, that seems to be the
problem with this code....

Thanks for any help.