[Zope] Re: Getting Properties of Objects in Folders Within Catalog
Results
Max M
maxm at mxm.dk
Fri Feb 4 03:58:32 EST 2005
J Cameron Cooper wrote:
>> 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).
>>
> 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.
You can get the information you need working only in the catalog, by
using the getPath() method of the brain. (untested naturally)
results = []
for brain in catalog(meta_type='Folder'):
print brain.Title
path = brain.getPath()
# this should get you every catalogued object in the folder
for subbrain in catalog(path=path):
print subbrain.Title
print subbrain.Description
This will return all you catalogued content, so you might want to narrow
your search a bit.
--
hilsen/regards Max M, Denmark
http://www.mxm.dk/
IT's Mad Science
More information about the Zope
mailing list