[Zope] Maybe a stupid newbie question - forcing an in loop to the Root Folder's context.

Jim Washington jwashin@vt.edu
Sat, 17 Nov 2001 13:38:19 -0500


Jim Nicholson wrote:

>I've created a method in the root folder that basically does some dtml-in 
>looping over objectValues. It works fine when included (via var) in other 
>methods and docs in the root window.
>
>The problem is that I want it to be aquired by sub-folders, but want it to 
>still loop through the root folder's contents.
>
>In other words, I should be able to call my method anywhere in sub-folders or 
>items deep in the site, and still get a list of objects in the root folder.
>
>Can I do this in DTML? Does it require python? Does it need to be an external 
>script? Can someone point me in a direction?
>
Hi, Jim

Probably best to create the list of objectValues in a python script in 
the root.  Something like:

return container.objectValues('Folder')

which, since root is the container, would always return the Folders in 
the root folder.  

If you name it something like 'nav_list', then you can replace the 
<dtml-in "objectValues()"> in the method you are currently using with
<dtml-in nav_list>

hth,

-- Jim Washington