Ejemplo n.º 1
0
    def send(self, is_celery=True):
        from dbmail.signals import pre_send, post_send, post_exception

        if self._template.is_active:
            try:
                pre_send.send(
                    self.__class__, instance=self, **self._signals_kw)
                if is_celery is True:
                    self._send()
                else:
                    self._try_to_send()
                self._store_log(True)
                post_send.send(
                    self.__class__, instance=self, **self._signals_kw)
                return 'OK'
            except StopSendingException:
                return
            except Exception as exc:
                post_exception.send(
                    self.__class__,
                    instance=self,
                    exc_instance=exc,
                    **self._signals_kw
                )
                self._err_msg = traceback.format_exc()
                self._err_exc = exc.__class__.__name__
                self._store_log(False)
                if self._ignore_exception():
                    return
                raise
Ejemplo n.º 2
0
    def send(self, is_celery=True):
        from dbmail.signals import pre_send, post_send, post_exception

        if self._template.is_active:
            try:
                pre_send.send(
                    self.__class__, instance=self, **self._signals_kw)
                if is_celery is True:
                    self._send()
                else:
                    self._try_to_send()
                self._store_log(True)
                post_send.send(
                    self.__class__, instance=self, **self._signals_kw)
                return 'OK'
            except StopSendingException:
                return
            except Exception as exc:
                post_exception.send(
                    self.__class__,
                    instance=self,
                    exc_instance=exc,
                    **self._signals_kw
                )
                self._err_msg = traceback.format_exc()
                self._err_exc = exc.__class__.__name__
                self._store_log(False)
                if self._ignore_exception():
                    return
                raise