[Zope] automagic reindexing of objects

Florent Guillaume fg at nuxeo.com
Mon Jun 20 12:00:54 EDT 2005


Dieter Maurer  <dieter at handshake.de> wrote:
> Jürgen Herrmann wrote at 2005-6-17 14:19 +0200:
> >i make heavy use of indexes in my extension classes. these all inherit
> >from catalogpathaware, so i have to call object.reindex_object() on
> >each changed instance. calling it from attribute getters/setters f.ex.
> >is not a good idea, because changing 3 attributes will reindex the object
> >3 times.
> >
> >what i'd like to have is that such objects are reindexed automatically
> >before comitting a transaction.
> >
> >is it possible? where should i start looking in the source, is there
> >possibly a before_transaction_commit hook?
> 
> It is impossible with "ZODB 3.2" (unless you patch
> "ZODB.Transaction.Transaction").

The CPSCompat module of CPS has monkey-patches that backport this from
ZODB 3.4, among others, to be used in Zope 2.7.

http://svn.nuxeo.org/trac/pub/file/CPSCompat/trunk/PatchZODBTransaction.py

Florent

> "ZODB 3.4" (which is used for Zope 2.8/3.1) has hooks
> that makes it possible.


-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope mailing list