diff -r aff75b69db92 -r 2c48c091b6a2 sobjects/notification.py --- a/sobjects/notification.py Tue Jul 02 17:09:04 2013 +0200 +++ b/sobjects/notification.py Mon Jan 13 13:47:47 2014 +0100 @@ -128,26 +128,34 @@ # since the same view (eg self) may be called multiple time and we # need a fresh stream at each iteration, reset it explicitly self.w = None - # XXX call render before subject to set .row/.col attributes on the - # view try: - content = self.render(row=0, col=0, **kwargs) - subject = self.subject() - except SkipEmail: - continue - except Exception as ex: - # shouldn't make the whole transaction fail because of rendering - # error (unauthorized or such) XXX check it doesn't actually - # occurs due to rollback on such error - self.exception(str(ex)) - continue - msg = format_mail(self.user_data, [emailaddr], content, subject, - config=self._cw.vreg.config, msgid=msgid, references=refs) - yield [emailaddr], msg - if isinstance(something, Entity): - self._cw.commit() - self._cw.close() - self._cw = req + # XXX call render before subject to set .row/.col attributes on the + # view + try: + content = self.render(row=0, col=0, **kwargs) + subject = self.subject() + except SkipEmail: + continue + except Exception as ex: + # shouldn't make the whole transaction fail because of rendering + # error (unauthorized or such) XXX check it doesn't actually + # occurs due to rollback on such error + self.exception(str(ex)) + continue + msg = format_mail(self.user_data, [emailaddr], content, subject, + config=self._cw.vreg.config, msgid=msgid, references=refs) + yield [emailaddr], msg + except: + if isinstance(something, Entity): + self._cw.rollback() + raise + else: + if isinstance(something, Entity): + self._cw.commit() + finally: + if isinstance(something, Entity): + self._cw.close() + self._cw = req # restore language req.set_language(origlang) @@ -198,7 +206,7 @@ kwargs.update({'user': self.user_data['login'], 'eid': entity.eid, 'etype': entity.dc_type(), - 'url': entity.absolute_url(), + 'url': entity.absolute_url(__secure__=True), 'title': entity.dc_long_title(),}) return kwargs