[ZODB-Dev] Re: [Zope-dev] Re: post publishing hook

Jeremy Hylton jhylton at gmail.com
Mon Apr 4 11:42:58 EDT 2005


On Apr 4, 2005 10:38 AM, Jim Fulton <jim at zope.com> wrote:
> >> If you register a synchronizer with the transaction manager, it's
> >> beforeCompletion() method will be called immediately before changing
> >> the transaction's state to committing.  This hook was intended in part
> >> to support use cases like "do something magic to the transaction
> >> before it commits."  It looks like the registerSynch() method of the
> >> transaction manager is undocumented, but that is an oversight.
> >
> >
> > Ok, and I see that beforeCompletion(t) has to check t.status to find out
> > when it is called (if the transaction is ACTIVE it's ok, otherwise it's
> > been called by abort() -- the fact that abort() calls it should probably
> > be documented).
> 
> I think that this is not the right mechanism.  It's not really
> intended for application code and is far to complex for what is,
> IMO, a very simple case.

I don't have anything invested in the decision, but synchronizers were
intended to support this use case.  They provide a way for arbitrary
application code to observe the transaction boundaries without
pretending to be a data manager.

Jeremy


More information about the ZODB-Dev mailing list