[Zope] CatalogBrains getObject raised an error

Pavlica, Nick Pavlica, Nick" <nick.pavlica@echostar.com
Fri, 27 Jun 2003 10:35:54 -0600


On Friday 27 June 2003 1:35 am, Max M wrote:
> 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.

What is the best way to clean up the catalog & re-index?   


>
>
> 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

-- 
Nick Pavlica
EchoStar Communications
CAS-Engineering
(307)633-5237