Question

How can I setup hooks that fire on ZODB object changes post-commit? I can setup handlers for IObjectWillBeMovedEvent and IObjectWillBeAddedEvent, but these fire immediately on object creation. Is there some other event or hook I can use that will only fire when the changes have been committed?

Was it helpful?

Solution

The transaction package for Python does not use zope.event event notification, and has its own system for registering callable hooks. However, you must add the hook for each running transaction, which you might consider doing in an IObjectModifiedEvent (or similar) using zope.event.

See the description for ITransaction.addAfterCommitHook().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top