[Zope] Re: "dtml-in" question

Maik Jablonski maik.jablonski@uni-bielefeld.de
Fri, 24 Jan 2003 12:48:38 +0100


Thierry Florac wrote:
>   Hi,
> 
> A little question about the "dtml-in" tag.
> 
> What I'd like to do is to build a list according to a property value,
> like we can do with for "for" Python instruction, something like :
> 
>   <dtml-in "object for object in objectValues() if object.visible">
> 
> Is there any way to achieve this, without writing a custom method ??

Use a PythonScript or something like ZopeFind from 
lib/OFS/FindSupport.py (works the same way as you click Find on a 
Folder, just call it directly):

     def ZopeFind(self, obj, obj_ids=None, obj_metatypes=None,
                  obj_searchterm=None, obj_expr=None,
                  obj_mtime=None, obj_mspec=None,
                  obj_permission=None, obj_roles=None,
                  search_sub=0,
                  REQUEST=None, result=None, pre=''):
         """Zope Find interface"""

Example:

<dtml-in "ZopeFind(this(), obj_expr='visible')">
  <dtml-var getId>
</dtml-in>

-mj