[ZCM] [ZC] 2273/ 2 Comment "ConflictError causes multiple Emails, multiple external database calls..."
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Sat, 03 Feb 2007 03:36:34 -0500
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #2273 Update (Comment) "ConflictError causes multiple Emails, multiple external database calls..." Status Pending, Zope/feature+solution medium To followup, visit: http://www.zope.org/Collectors/Zope/2273 ============================================================== = Comment - Entry #2 by ajung on Feb 3, 2007 3:36 am Interesting idea. However some unittests are required for inclusion of the patch ________________________________________ = Request - Entry #1 by marc_mengel on Feb 2, 2007 3:31 pm Uploaded: "patch" - http://www.zope.org/Collectors/Zope/2273/patch/view When a Zope object does something which is visible outside of the ZODB (i.e. sending email, queuing a print job, updating an external relational database, etc.) and then does something else that generates a ConflictError, Zope abort()s the transaction and re-runs the code, this then causes the externally visible action to happen AGAIN (i.e. two (or three) email's get sent, two (or three) database records get added...) This patch builds an afterCommitHook queue, like the beforeCommitHook queue that exists, so you can queue up those actions, and run them after (and only if) the commit succeeds. The MailHost object is patched to do so. ==============================================================