[Zope] ZPT list is dead... zpt nav question

J Cameron Cooper zope-l at jcameroncooper.com
Thu Apr 14 02:50:59 EDT 2005


Norbert Ray-Goldman wrote:
> so I am posting this here. I would like my zpt to list only folders in
> a director - essentially filtering out all other meta_type(s)... can
> you tell me where I am going wrong with the filtering here ?
> 
> 
> ################################################
> 
> <html>
>   <head>
>     <title tal:content="template/title">The title</title>
>   </head>
>   <body>
> <span>
> <a href="HOME_URL" tal:attributes="href container/absolute_url"
>            tal:content="container/title_or_id">TITLE OR ID</a>
> 
> <span tal:repeat="item here/objectValues">
> <a href="" tal:attributes="href item/absolute_url"
> tal:condition="python:item.meta_type=='Folder'">URL</a>
> </span>
> 
> </span>
> 
>   </body>
> </html>

You don't have to do the filtering yourself. Just pass objectValues (or 
any of its related methods) a meta_type and it will return only those. 
You can even pass a list if you want to filter on several.

See the API docs: 
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixB.stx

		--jcc



More information about the Zope mailing list