[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.
</P>
<P><STRONG>Unauthorized</STRONG></P>
Sorry, a site error occurred.<p>
<!--
Traceback (innermost last):
File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 223, in
publish_module
File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 187, in
publish
File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in
publish
File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in
mapply
(Object: testdtmlmeth)
File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in
call_object
(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
render
(Object: name="0")
File /usr/lib/zope/lib/python/TreeDisplay/TreeTag.py, line 154, in
render
(Object: a tree tag)
File /usr/lib/zope/lib/python/TreeDisplay/TreeTag.py, line 260, in
tpRender
(Object: ApplicationDefaultPermissions)
File /usr/lib/zope/lib/python/TreeDisplay/TreeTag.py, line 336, in
tpRenderTABLE
(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>
<p>
This is the <dtml-var document_id> Document
in the <dtml-var title_and_id> Folder.
</p>
<dtml-comment>
<dtml-tree>
<dtml-var title_or_id>
</dtml-tree>
</dtml-comment>
<dtml-let name="0">
<dtml-tree id=name branches_expr="child_lookup(parent=name)">
<b><dtml-var name></b>
</dtml-tree>
</dtml-let>
<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
/var/lib/zope/Extensions/):
class _dummy:
__allow_access_to_unprotected_subobjects__=1
def __init__(self, name):
self.name=name
def child_lookup3(parent):
c = []
for i in range(0,5):
c.append(_dummy("%s.%d"%(parent, i)))
return c