FYI in CPS we use a simple backport of the before commit hook to ZODB 3.2:

For now we use it to delay indexing of some objects to the end of the
transaction (to avoid indexing twice the same object for instance):

To index something, code just has to do:

In get_indexation_manager() I have to check if there is already a
registered IndexationManager hook with the transaction. I currently use
a hack, but what I'd need is a way to query the registered hooks. What
do people think of adding something like:

def getBeforeCommitHooksImplementing(self, class_):
    """Get the registered beforeCommit hooks subclassing class_."""
    return [(hook, args, kws) for hook, args, kws in self._before_commit
            if isintance(hook, class_)]

(Interfaces could probably be a better choice than classes.)
Or is it overengineering ? Maybe just a getBeforeCommitHooks that
returns self._before_commit ?


Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   [EMAIL PROTECTED]
For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -

Reply via email to