[Zope] dtml-tree and branches
Anton Gyllenberg
Anton Gyllenberg <anton@lifix.fi>
Mon, 17 Jan 2000 14:47:33 +0200
My namespace gets lost when I try to use the `branches' attribute
of the `dtml-tree' tag.
Example:
<dtml-tree branches=some_method>
...
</dtml-tree>
`some_method' is a dtml-method with the following template:
<dtml-return "objectValues(['Folder', 'DTML Document', 'File'])">
Rendering the dtml-tree results in:
Error Type: NameError
Error Value: objectValues
In this particular case I could use
brances_expr="objectValues(['Folder', 'DTML Document', 'File'])",
but I plan on augmenting the branch-list with some other objects before
returning from `some_method'. `some_method' works fine if I call it
using
<dtml-var "some_method(_.None, _)">,
but apparently this is not the way the method is called by the
dtml-tree tag. I also tried
<dtml-tree branches_expr="some_method(_.None, _)">
Unfortunately, it seems that the namespace where branches_expr is
evaluated doesn't contain the namespace variable `_'.
What am I doing wrong? How can I use a DTML-method to calculate the list
of branches? By the way, if the branches attribute names a nonexistent
method, the tree ends up empty without triggering any errors. I really
would expect a name error here. Is this a bug?
<dtml-tree branches=no_such_method>...</dtml-tree> -> empty tree.
Yes, and I'm using:
Zope version: Zope 2.1.2 (source release, python 1.5.2, linux2)
Grateful for any help,
--
Anton Gyllenberg <anton@lifix.fi> +358-50-3412792