[ZODB-Dev] zodb connection question

Jim Fulton jim at zope.com
Tue Jul 12 06:41:00 EDT 2005


Jürgen Herrmann wrote:
> hi all!
> 
> i'm trying to form a patch that will result in a method "_before_commit()"
> being called on each modified object in a transaction (if that method
> exists of course) right before commit.
> main sense is to automate/delay (re)cataloging.
> 
> first i looked at the Transaction class, as there have been heavy
> modifications to it from zodb 3.2 to 3.4

Patching is generally a bad idea.

I suggest creatinga new catalog (by subclassing or adapting an existing one)
that:

- queues updates

- registers a before-commit callback with the TM on the first update
   in a transaction

- processes the queue in the callback

I did this recently for with Zope 3's catalog and it worked very well.
(I happend to use subclassing and would use adaptation if I were to
do it again.)

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list