[Zope] How to get a catalogware object's ZCatalog

Max M maxm@mxm.dk
Fri, 06 Jun 2003 15:04:04 +0200


Nico Grubert wrote:

>I already tried that method "default_catalog" (defined in the 'CatalogAware' class) but it returns "Catalog" which can't be right, because 'myobj' is cataloged in a ZCatalog called "MyCatalog".
>  
>

Then you must have cataloged the object manually. In this case there is 
probably no way you can know what catalog an object is cataloged in. Ie. 
there is no reason why an object could not be cataloged this way in 
several different catalogs.

Also when your object tries to re-catalog itself after a change, it will 
do so in the default_catalog.

You should set your default_catalog to "MyCatalog" in  the objects you 
want to catalog in another catalog.

regards Max M