[Zope] Catalog aware object

Sven Rudolph rudolph@medical-tribune.de
Mon, 13 Jan 2003 19:01:26 +0100


Hello Ullrich,

> can a catalog aware object be indexed in several ZCatalogs
> and update itself in all ZCatalogs that index this object?

I suppose you are talking about product that inherits from "CatalogAware".
If this is the case, your object has a method called "index_object" and needs an string attribute called "default_catalog".
When you call index_object() the method looks for the value of default_catalog (for example default_catalog="MyZCatalog") and calls
getattr(self, self.default_catalog).catalog_object(self, self.url())
The catalog now indexes only this object.

If you have several catalogs try this (may contain errors):

catalog_list = ['MyZCatalog1','MyZCatalog2','MyZCatalog3',]
default_catalog='MyZCatalog1'

for item in catalog_list:
	""" Index in multiple catalogs at once """
        self.default_catalog=catalog
        self.index_object()
self.default_catalog='MyZCatalog1'


Hope I was of any help

Greetings

Sven Rudolph

-- 
Sven Rudolph, Programmierer
Medical Tribune Verlagsgesellschaft mbH
Unter den Eichen 5, 65195 Wiesbaden
Tel.: 06 11 / 97 46 25 2