Domanda

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?

È stato utile?

Soluzione

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().

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top