[Zope] array won't clear

Oliver Bleutgen myzope@gmx.net
Wed, 08 Jan 2003 19:33:56 +0100


michael.taņag wrote:
> hi again.
> 
> OK. I tried this to get the files in my directory into an array (even
> those in the subdirectory). I got the file objects into the array, but
> i can't seem to clear the array afterwards. so everytime i run the dtml
> method, the array keeps appending. 


I assume that you mean "everytime I call the dtml-method in the same 
request ...", i.e. if you do a reload on that page,  you won't get this 
appending, right?
But anyway, there's ZopeFind which can do that job for you, try that in 
a python script:

startfolder = container

list = container.ZopeFind(
     startfolder,
     obj_metatypes=['File'],
     search_sub = 1)

return list

where startfolder is the folder which should be the root of the hierachy 
you want to search in.

This returns a list of tuples (object_id, object) analogous to 
objectValues(), but recursive.


HTH,
oliver