[Zope] Cataloging objects with a property set

Heimo Laukkanen huima@fountainpark.org
Mon, 29 Jul 2002 13:37:14 +0300


Hi all,

this is just a small tip - that you all propably know, but which hasn't 
been mentioned that often.

How do you use ZCatalog to catalog for example all your page 
template-files, but leave those files out that are not intended for the 
public to see - for example the master templates that only control the 
layout.

Answer is to use ZCatalogs expression field and properties of objects.

For example I put to my those PageTemplates that I don't want to see in 
the search a new property called search and 0 as a value. And to 
expression field while searching new objects I put:

getProperty('search', d=1)

This way the ZCatalog will catalog all the PageTemplates that fit with 
the other requirements of the query and do not have search-property set 
to 0. The secon parameter - like said in the API - says that if 
search-property is not set, then this value will be given.

Hope this helps others!

-huima