[ZODB-Dev] RFC: Pre-commit hooks

Jim Fulton jim at zope.com
Mon Apr 4 11:51:04 EDT 2005


Florent Guillaume wrote:
> Jim Fulton  <jim at zope.com> wrote:
...
>>Proposal
>>
>>   We add a new method to transaction objects:
>>
>>      def beforeCommitHook(hook, *args, **kw):
>>          """Register a hook to call before the transaction is committed
>>
>>           The provided hook will be called after the transaction's
>>           commit method has been called, but before the commit process
>>           has been started.  The hook will be passed the given
>>           positional and keyword arguments.
> 
> 
> The hook probably may want to be called with the transaction object
> itself as arguments, or is it a YAGNI? I'm saying this because
> synchronizers are passed the transaction, OTOH this is at a slightly
> higher level and we may not care about the transaction.

If the hook wants the transaction, then the transaction can be passed as
one of the arguments when the hook is registered.

...

>>Anyone up for implementing this (with a doctest, of course)?
> 
> 
> Yes I'll look at it.

Great! Thanks.

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