[Zope] DTML-In with filter

Tino Wildenhain tino at wildenhain.de
Wed Mar 8 08:43:41 EST 2006


Martin Koekenberg schrieb:
> Hello,
>  
> Is it possible to use a DTML-In to display all DTML Documents in a 
> folder exept the one's with a centain value in a property ?
>  
> Example.
>  
> DTML Document one with property a=bc
> DTML Document two with property a=de
> DTML Document three with property a=bc
>  
> Now I want to use DTML-IN to display all the dtml documents except the 
> ones with property a=de.
> I also use the size and batchsize property to create links to the next 
> 10 documents..... If I use an if statement the next 10 can be 9 ore 
> less 9 items because there could be one ore more documents with a=de.

Just drop this DTML... or at least get help from python:

return [doc for doc in context.objectValues('DTML Document')  if 
doc.getProperty('a')!='de']

(python script or the like would be your friend - also
it makes it possible to replace the quite costy objectValues()
call with ZCatalog query w/o changing your presentation code)

Regards
Tino


More information about the Zope mailing list