Automatically reindexing CatalogAware objects
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
----- Original Message ----- From: "Itamar Shtull-Trauring" <itamars@ibm.net> To: <zope-dev@zope.org> Sent: Tuesday, February 15, 2000 9:28 AM Subject: [Zope-dev] Automatically reindexing CatalogAware objects
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:
This sounds like a good thing to me, unless __getstate__ is called at times other than just when the transaction is committed. reindex_object takes a little bit of time to run and can cause the Data.fs file to balloon in size, so you don't really want to do it more than necessary. Kevin
participants (2)
-
Itamar Shtull-Trauring -
Kevin Dangoor