سؤال

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?

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top