[Zope] dtml-tree again

Marc O. Sandlus marc@sandlus.de
Sun, 14 Oct 2001 13:38:45 +0200

Hi again

Sorry to bother you again.
I just want to make _one_ example work.

But all I get is (after I tried to authenticate with my Zope-Login,
which failed) (I got this HTML-Source):

 <H2>Site Error</H2>
  <P>An error was encountered while publishing this resource.

  Sorry, a site error occurred.<p>
Traceback (innermost last):
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 223, in
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 187, in
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in
  File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in
    (Object: testdtmlmeth)
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in
    (Object: testdtmlmeth)
  File /usr/lib/zope/lib/python/OFS/DTMLMethod.py, line 189, in __call__

    (Object: testdtmlmeth)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 540,
in __call__
    (Object: testdtmlmeth)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_Let.py, line 149, in
    (Object: name=&quot;0&quot;)
  File /usr/lib/zope/lib/python/TreeDisplay/TreeTag.py, line 154, in
    (Object: a tree tag)
  File /usr/lib/zope/lib/python/TreeDisplay/TreeTag.py, line 260, in
    (Object: ApplicationDefaultPermissions)
  File /usr/lib/zope/lib/python/TreeDisplay/TreeTag.py, line 336, in
    (Object: ApplicationDefaultPermissions)
Unauthorized: [0]

Why do I have to authenticate anyway?

So this is what I did (with the help from this list):

I added DTMLMethod "testdtmlmeth" (inside the root folder):
<dtml-var standard_html_header>
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
This is the <dtml-var document_id> Document
in the <dtml-var title_and_id> Folder.

<dtml-var title_or_id>

<dtml-let name="0">
<dtml-tree id=name branches_expr="child_lookup(parent=name)">
<b><dtml-var name></b>

<dtml-var standard_html_footer>

Then, I added External Method "child_lookup":
Id: child_lookup
Module Name: child_lookup2
Function Name: child_lookup3

And a file called "child_lookup2.py" inside my Extensions dir (which is

class _dummy:
        def __init__(self, name):

def child_lookup3(parent):
        c = []
        for i in range(0,5):
                c.append(_dummy("%s.%d"%(parent, i)))
        return c