[ZODB-Dev] RFC: Pre-commit hooks

Jeremy Hylton jhylton at gmail.com
Mon Apr 4 11:52:54 EDT 2005


On Apr 4, 2005 10:53 AM, Jim Fulton <jim at zope.com> wrote:
>    We would also modify transaction commit methods to call hooks.  Hooks would
>    not be called on sub-transaction commit.  (If necessary, we could add
>    separate sub-transaction hooks, but I don't think we need this.)

The effect here is to register a one-short synchronizer, so all the
code already exists.  Or, add another line just after the
beforeCompletion() call in _transaction.py.  I think the question to
ask is how to make these two closely related APIs understandable to
users.  The synchronizers API is slightly more general, but still
focused clearly on observing transaction boundaries.  Perhaps the new
hook is just a sugar on top of the synchronizer API.

>    This hook is very simple to use an implement and, I think, addresses
>    the requitement much more directly than implementing special data
>    managers.

Perhaps you misunderstand the synchronizer API.  It does not deal with
data managers at all.  The registered objects just implement
beforeCompletion() and afterCompletion().

Jeremy


More information about the ZODB-Dev mailing list