Re: [Zope] How to get a catalogware object's ZCatalog
Such an object should have an attribute named default_catalog.
So, getattr(myobj,myobj.default_catalog) should give you the catalog object via acquisition.
HTH, oliver
hi oliver, 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". -nico ____________________________________________________________________________ Jetzt bei WEB.DE FreeMail anmelden = 1qm Regenwald schuetzen! Helfen Sie mit! Nutzen Sie den Serien-Testsieger. http://user.web.de/Regenwald
Nico Grubert wrote:
Such an object should have an attribute named default_catalog.
So, getattr(myobj,myobj.default_catalog) should give you the catalog object via acquisition.
HTH, oliver
hi oliver,
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".
We are talking about a filesystem based product here which mixes in CatalogAware? I find it hard to believe that what you describe is possible, because CatalogAware's index_object() method uses the value of default_catalog to find the Catalog instance to index in. Maybe provide more specifics. cheers, oliver
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
participants (3)
-
Max M -
Nico Grubert -
Oliver Bleutgen