[Zope] Getting Properties of Objects in Folders Within Catalog
J Cameron Cooper
zope-l at jcameroncooper.com
Thu Feb 3 17:19:38 EST 2005
John Tynan wrote:
> I am using the following script to get objects out of the catalog:
> objects = 
> results = 
> for object in context.Catalog(meta_type='Folder'):results.append(object)
> print results
> return results
> And I recieve the following results:
> [<mybrains instance at 22E275B0>, <mybrains instance at 14AEC958> ]
> However, I would like to get information about objects within each of
> the folders that are returned (such as the id and description of images
> that are contained in the folders).
> I know this information would not be part of each folder's entry in the
> catalog, but can it be obtained through aquisition -- perhaps if I know
> the path to the object?
> Can this be done using a python script to query the catalog, and then
> dtml to access the namespace for each folder?
The getObject method on 'mybrains' will give you a handle to the object
itself, which should be just as good as getting it through any other method.
Note that you are waking up the objects when you do this.
The alternate nasty way is to use restrictedTraverse on the path
metadata on each object.
"Building Websites with Plone"
More information about the Zope