[Zope] nested dtml-with

Max M maxm@mxm.dk
Thu, 13 Jun 2002 10:43:46 +0200


Paul Zwarts wrote:

>I tried your code out, but subTree('Folder') returns an attribute error
>and I cant find anything under 'subTree' search anywhere on zope.org..
>Are you sure that's what it is? 
>

You need to define a Python script called subTree ... see my code example.

>I'd like to be able to call a document from the root of my site based on
>a list stored in a Session.
>

You are either talking nonsense, skipping several lines of thought, or I 
havn't understood a bit! Was your problem not that you wanted to get a 
list of all objects and subobjects in a folderish object?

regards Max M

>From: Max M [mailto:maxm@mxm.dk] 
>Sent: Thursday, June 13, 2002 8:33 AM
>To: Paul Zwarts
>Cc: zope@zope.org
>Subject: Re: [Zope] nested dtml-with
>
>Don't do recursion in dtml. It's a cardinal sin, and it will make your 
>head explode.
>
>Do it in a Python script instead.
>
>untested::
>
>    def subTree(context, type=None):
>        """
>        Returns the entire sub-branch below this recursively as a flat
>list
>        """
>        children = context.objectValues(type)
>        grandChildren = []
>        for child in children:
>            grandChildren += child.subTree(type)
>        return children + grandChildren
>   
>
>regards Max M
>
>
>  
>
-- 

"Sorry I would Really Like To Help More On This Project,
But Am To Busy Doing Paid Work On A Tight Deadline"
    Max M