# HG changeset patch # User Julien Cristau # Date 1427708863 -7200 # Node ID df34de44f40f54f93609fdf821d4d4a2cbbfe44e # Parent 080ac14df6fa7005f7e104c5e9f0bd6e0e661a25 [notification] don't block while sending mails Regression from #7c17659c9eae, closes #5190001. diff -r 080ac14df6fa -r df34de44f40f sobjects/notification.py --- a/sobjects/notification.py Sun Feb 01 22:17:25 2015 +0100 +++ b/sobjects/notification.py Mon Mar 30 11:47:43 2015 +0200 @@ -81,7 +81,11 @@ # this is usually the method to call def render_and_send(self, **kwargs): """generate and send email messages for this view""" - self._cw.vreg.config.sendmails(self.render_emails(**kwargs)) + # render_emails changes self._cw so cache it here so all mails are sent + # after we commit our transaction. + cnx = self._cw + for msg, recipients in self.render_emails(**kwargs): + SendMailOp(cnx, recipients=recipients, msg=msg) def cell_call(self, row, col=0, **kwargs): self.w(self._cw._(self.content) % self.context(**kwargs))