[Zope] CatalogBrains getObject raised an error

Max M maxm@mxm.dk
Fri, 27 Jun 2003 09:35:20 +0200


Pavlica, Nick wrote:
> I'm experiencing an error that I haven't seen yet.  Is there a simple 
> resolution to this ?  I need to have this site ready for production and don't 
> want to ship it with an error that I don't understand.  I have several 
> instances of this message printing to standard out.


Most likely it is a CatalogAware object that is in the catalog, but no 
longer exists.

Clean up the catalog, or Just put an exception around it.


Whenever I need to call getObject I pass the catalog result through this 
small utillity function.

## Script (Python) "util_brains2objs"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=cat_results
##title=Turn catalog brains to objects
##

# Turns a list of catalog results (brains) into objects,
# skipping dead catalog results
results = []
for cat_res in cat_results:
     try:
         results.append(cat_res.getObject())
     except: # sometimes there are dead objects in the catalog
         pass
return results


regards Max M