[ZCM] [ZC] 2273/ 1 Request "ConflictError causes multiple Emails, multiple external database calls..."
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Fri, 02 Feb 2007 15:31:05 -0500
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #2273 Update (Request) "ConflictError causes multiple Emails, multiple external database calls..." Status Pending, Zope/feature+solution medium To followup, visit: http://www.zope.org/Collectors/Zope/2273 ============================================================== = 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. ==============================================================