[Zope] dtml-tree and a filtered objectValues

Jim Hebert jim@cosource.com
Tue, 9 Jan 2001 18:33:54 -0500 (EST)


OK, this works:

My DTML Method, "y":

<dtml-tree branches_expr="objectValues(['Folder'])">
foo
</dtml-tree>

If I change z to read as follows, it breaks:

<dtml-tree branches_expr="_['y']">
foo
</dtml-tree>

where y is a DTML Method simply containing

<dtml-return "objectValues(['Folder'])">

The error I get is:

  <STRONG>Error Type: AttributeError</STRONG><BR>
  <STRONG>Error Value: __getitem__</STRONG><BR>
...
Traceback (innermost last):
  File /usr/local/Zope-2.2.4-src/lib/python/ZPublisher/Publish.py, line
222, in publish_module
  File /usr/local/Zope-2.2.4-src/lib/python/ZPublisher/Publish.py, line
187, in publish
  File /usr/local/Zope-2.2.4-src/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
    (Object: ApplicationDefaultPermissions)
  File /usr/local/Zope-2.2.4-src/lib/python/ZPublisher/Publish.py, line
171, in publish
  File /usr/local/Zope-2.2.4-src/lib/python/ZPublisher/mapply.py, line
160, in mapply
    (Object: y)
  File /usr/local/Zope-2.2.4-src/lib/python/ZPublisher/Publish.py, line
112, in call_object
    (Object: y)
  File /usr/local/Zope-2.2.4-src/lib/python/OFS/DTMLMethod.py, line 172,
in __call__
    (Object: y)
  File /usr/local/Zope-2.2.4-src/lib/python/DocumentTemplate/DT_String.py,
line 528, in __call__
    (Object: y)
  File /usr/local/Zope-2.2.4-src/lib/python/TreeDisplay/TreeTag.py, line
154, in render
    (Object: a tree tag)
  File /usr/local/Zope-2.2.4-src/lib/python/TreeDisplay/TreeTag.py, line
260, in tpRender
    (Object: ApplicationDefaultPermissions)
  File /usr/local/Zope-2.2.4-src/lib/python/TreeDisplay/TreeTag.py, line
324, in tpRenderTABLE
    (Object: ApplicationDefaultPermissions)
AttributeError: (see above)


This is my boiled down example. The real need for this is because I don't
wish to use the full objectValues list, I have another DTML Method which
does this:

<dtml-call "REQUEST.set('tmpa',[])">
<dtml-in "objectValues(['Folder','Redirector'])">
<dtml-let si=sequence-item>
<dtml-if "_.SecurityCheckPermission('Reference in NFGnav', this())">
<dtml-call "tmpa.append(this())">
</dtml-if>
</dtml-let>
</dtml-in>
<dtml-return tmpa>

So, for those who are interested in the story, I've been using NFGnav, and
have a fair amount of effort invested in marking things as Reference in
NFGnav or not, and would like to move to a dtml-tree which respects that
setting. The dtml method above gives me a subset of objectValues, those
which are maked 'Reference in NFGnav.'

Note, also, that this works (stolen from someone on zope.org's tips for
debugging a tree):

 <dtml-in "_['nfgObjectValues']" sort=sortkey>
  <<stuff>>
   <dtml-in "_['nfgObjectValues']" sort=sortkey>
    <<same sort of stuff>>
   </dtml-in>
 </dtml-in>

where nfgObjectValues is the dtml method above.

Any help? Is this a bug in dtml-tree, given that it pukes on something
that dtml-in doesn't?

Thanks,
jim