Traversing a Root Level Folder's Hierarchy
Hello. Does anyone know how to traverse a folder hierarchy in Zope? More specifically, I would like to add a property to all folder objects that lie beneath a root level folder-the only way to do this is to traverse the folder hierarchy that lies beneath this root level folder. Using the dtml-tree command allows me to go only one layer deep at a time and the same applies for the dtml-in command. Any input would be greatly appreciated. Thanks. -Asad __________________________________________________ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com
Hello. Does anyone know how to traverse a folder hierarchy in Zope? More specifically, I would like to add a property to all folder objects that lie beneath a root level folder-the only way to do this is to traverse the folder hierarchy that lies beneath this root level folder. Using the dtml-tree command allows me to go only one layer deep at a time and the same applies for the dtml-in command. Any input would be greatly appreciated. Thanks.
Forget DTML. It's presentation. This is logic. Make yourself a recursive Python Script: - you pass in a folder/folder id - it adds your attribute to that folder - it looks up all the (folderish) children of that folder - it calls itself on those children, if any And suddenly, you've got yourself a tree walker. All of the steps above can be found in the online help system's API reference, but let us know if you stumble on anything. Note: I didn't test this (else I'd have given you the code!) but there's no reason it shouldn't work. --jcc (a clean separation)
Asad Habib wrote at 2003-2-11 05:30 -0800:
Hello. Does anyone know how to traverse a folder hierarchy in Zope? More specifically, I would like to add a property to all folder objects that lie beneath a root level folder-the only way to do this is to traverse the folder hierarchy that lies beneath this root level folder. Using the dtml-tree command allows me to go only one layer deep at a time and the same applies for the dtml-in command. Any input would be greatly appreciated. Thanks. Use "ZopeFind" (--> "OFS/FindSupport.py") to build a list of objects and apply your operation to this list.
Dieter
participants (3)
-
Asad Habib -
Dieter Maurer -
J. Cameron Cooper