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

Kai Vermehr k at eboy.com
Tue Nov 4 12:05:18 EST 2003


I'm still sruggling ... I have a page template that calls some python 
scripts (images (returns all image objects), image_date (returns 
formated modification date):

     <tr tal:repeat="item container/images">
       <td tal:content="item/image_date">2001/09/17</td>
       <td tal:content="item/absolute_url()">123</td>
    </tr>

how call the URL of an image that has been found "item/absolute_url()" 
obviously is wrong ...

also this did not work for scanning the subfolders ...

> images = container.ZopeFind(container, obj_metatypes=['Image'])

'K:?
--
Kai Vermehr / k at eboy.com
http://www.eboy.com

On 03.11.2003, at 20:15, Paul Winkler wrote:

> 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)
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>




More information about the Zope mailing list