[Zope] preventing transaction rollback

Andreas Jung lists at andreas-jung.com
Sun Sep 19 03:43:24 EDT 2004


Use MailDropHost. It ties mail delivery to the transaction system of Zope.

-aj

--On Sonntag, 19. September 2004 3:38 Uhr -0400 Sean Hastings 
<whysean at softhome.net> wrote:

> I have a section of code that I want to have run only once during a
> request. It mails out some information about the request. I want only one
> email per request even if a conflict occurs during the request. I am
> having no luck eliminating duplicate emails. I have tried this a few
> different ways now, but currently my code looks something like this:
>
> def theFunction(self,REQUEST):
> 	"docstring"
> 	...do some stuff...
> 	get_transaction().commit()
> 	try:
> 		...send the email...
> 		get_transaction().commit()
> 	except:
> 		pass
> 	...do some more stuff...
> 	return self.return_page_template(REQUEST)
>
> I thought that this try block with a commit() would isolate the send mail
> code in its own transaction, and then catch any conflict exception and
> ignore it. But I am still getting multiple emails per transaction when
> multiple requests happen at the same time and conflicts occur.
>
> How can I isolate a part of the code so that it can never roll back and
> execute again?
>
> --Sean
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )






More information about the Zope mailing list