Greetings, I have a developer here trying to fix a problem with some legacy 
Zope 2 (2.8.6) material. Basically, she is trying to change properties on a 
DTML document, but so far cannot get the script to recursively search through 
folders to act on every document in the hierarchy.

Any advice is greatly appreciated!



Hello, the things we want to do is to find every media file (DTML document) in 
a folder structure and change their format. They are a few folders deep and the 
number of folders that contain the file is unknown, so I tried to use a 
recursive way to get access to every document.

So this is what I did, I wrote a script named changeType with parameter 
"object", which is initially 0. Then when object is 0, just set object = 
context. If in "object" we found that there's another folder called f, just 
called changeType(f). The script is shown as below:

#parameter object = 0
from Products.PythonScripts.standard import html_quote
request = context.REQUEST

if object == 0:
   object = context

folders = object.objectValues(['Folder'])
for f in folders:
   fds = f.objectValues(['Folder'])
   if(len(fds) != 0):
   .......(methods to change format)

But this causes an error:

Error Type: AttributeError
Error Value: ‘str’ object has no attribute ‘objectValues'
I think the reason should be, it doesn't seen "object" or "context" as object 
and context but seen them just as strings. But I have no idea about how could I 
solve this or if there's any other way I can call a recursive method to get 
every DTML document in their respective subfolders. Please let me know if you 
have any suggestion/examples on Zope/found another error in my code/etc. 
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to