[Zope] Recursive Display Of All Folder Items
J Cameron Cooper
zope-l at jcameroncooper.com
Tue Dec 13 14:44:00 EST 2005
Francisco Chamorro wrote:
> Hi everyone, I am trying to get a dump of all the content currently in
> our zope server. Using DTML I was able to get the top level folders to
> display their content but I am unable to recursively display the
> contents of the sub-folders.
>
> This is the code I am using for my top level folders, where "TV" is the
> name of the folder I want to display.
>
> <dtml-in "TV.objectValues()"><dtml-var id><br></dtml-in>
>
>
> My second attempt at displaying sub-folder content was the following:
>
> <dtml-in "TV.objectItems()">
> id: <dtml-var id>,<br>
> type: <dtml-var meta_type><br>
> <dtml-if "meta_type=='Folder'">
> <dtml-in expr="objectValues(<dtml-var id>)">
> id: <dtml-var id>,<br>
> type: <dtml-var meta_type><br>
> </dtml-in>
> </dtml-if>
> </dtml-in>
>
> But that also fails. I searched the documentation and found a post
> about recursively calling the same function but that did not work as I
> get a "excessive recursion" error. Any help on this problem would be
> greatly appreciated.
objectValues is acquired on all objects, even non-folderish ones. Thus
recursion never stops. You must ask for it explicitly:
aq_inner.aq_explicit or something like that if I remember directly.
--jcc
--
"Building Websites with Plone"
http://plonebook.packtpub.com/
Enfold Systems, LLC
http://www.enfoldsystems.com
More information about the Zope
mailing list