[Zope] How to filter and sort PropertyObjects from ZCatalog

From: Christian Otteneuer (chotty_at_freenet.de)
Date: 09/30/04


Date: Thu, 30 Sep 2004 19:32:55 +0200

Hallo NG,

Hope, that I'm not totally wrong in this newsgroup. I have a question about
PropertyObjects in Zope:

I want to get some PropertyObjects out of a ZCatalog.

This Code:
result = (map( lambda brain: brain.getObject(),
       container.Catalog.searchResults()))

returns me a list of all Objects in the Catalog, which are, in this case
PropertyObjects.

These PropertyObjects have a property 'priority' (type: int) , which I can
access with:

result[0].getProperty('priority')

Now, I want to filter out all PropertyObjects, which have 'priority == 0'
and sort all other POs by 'priority',
so that I finally have a list like this:

result[0].getProperty('priority') == 1
result[1].getProperty('priority') == 2
result[2].getProperty('priority') == 3
...

Does anyone know, how to reach such a list
a) by changing the query to the ZCatalog with 'filters' and 'sort
algorithms'
or
b) by changing my list 'result' ??

Thanks alot