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

Paul Winkler pw_lists at slinkp.com
Tue Nov 4 12:16:12 EST 2003


Please keep the discussion on the mailing list...

On Tue, Nov 04, 2003 at 05:34:43PM +0100, Kai Vermehr wrote:
> 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 ...

you are confusing python expressions and path expressions.
You can do either of these:

       <td tal:content="item/absolute_url">123</td>

OR

       <td tal:content="python:item.absolute_url()">123</td>

If you have not already done so, you should read the Zope Book
online chapters about Page Templates and Scripting.

> also this did not work for scanning the subfolders ...
> 
> >images = container.ZopeFind(container, obj_metatypes=['Image'])

"this did not work" is not very clear. It works for me.

The result is a list of tuples of the form (id, object)
so maybe you are not handling the result correctly.

-- 

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



More information about the Zope mailing list