[Zope] Pyhton: how get ObjectValues in Subfolders? (and their URL?) /kv

Paul Winkler pw_lists at slinkp.com
Mon Nov 3 14:15:21 EST 2003


On Mon, Nov 03, 2003 at 04:52:38PM +0100, Kai Vermehr wrote:
> >From the Zope book I have this little script which returns a list of any
> images from the folder where it is called.
> 
>     return container.objectValues(['Image'])
> 
> how can I modify it so it also searches for images inside Subfolders?

try the ZopeFind method:
images = container.ZopeFind(container, obj_metatypes=['Image'])

However, if you do this a lot, you will find it a lot faster
to use the Catalog instead of ZopeFind.

> and how would I ask for their URLs?

use the absolute_url method:

urls = [img.absolute_url() for img in images]

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's ALMIGHTY CHICK!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list