[Zope] Search a Catalog in Python

Max M maxm at mxm.dk
Wed Mar 17 05:37:11 EST 2004


Chris Withers wrote:

> return [brain.getObject() for brain in self.__catalog(p_criteria)]
> 
> ...seems a LOT nicer to me.

You should at least check that getObject() does not return a None 
object. Which it can *very* easily do!

result = []
for brain in self.__catalog(p_criteria):
     obj = brain.getObject()
     if not obj is None:
         result.append(obj)
return result


regards Max M



-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science



More information about the Zope mailing list