[Zope-dev] Automatically reindexing CatalogAware objects
Itamar Shtull-Trauring
itamars@ibm.net
Tue, 15 Feb 2000 16:28:45 +0200
The problem with CatalogAware objects is that you have to add
self.reindex_object() to any method that updates them. I think I've thought
of a way to solve this - tell me if/where I'm wrong:
Every time a CA object gets changed a transaction is commited, which means
the object gets pickled and saved into the ZODB.
Every time an object is pickled its __getstate__ method is called.
So, we define the following __getstate__ for the CatalogAware class:
def __getstate__(self)
self.reindex_object()
# is __getstate__ supposed to return self?
return self
Would this work?
--
Itamar S.T. itamars@ibm.net