Fail on missing from_address
This commit is contained in:
parent
f53fd92cd3
commit
6afd791bef
2 changed files with 5 additions and 5 deletions
|
@ -10,6 +10,10 @@ def _declare_backend(backend_path):
|
|||
backend_module = importlib.import_module(backend_module_name)
|
||||
backend = getattr(backend_module, class_name)
|
||||
return backend(*args, **kwargs)
|
||||
|
||||
if from_address is None:
|
||||
raise ValueError("missing from_address")
|
||||
|
||||
_backend.from_address = from_address
|
||||
_backend.headers = headers
|
||||
return _backend
|
||||
|
|
|
@ -46,11 +46,7 @@ def todo_get_mailer(user, task):
|
|||
if task_backend is None:
|
||||
return (None, mail.get_connection)
|
||||
|
||||
from_address = getattr(task_backend, "from_address", None)
|
||||
if from_address is None:
|
||||
# worst fallback ever
|
||||
from_address = user.email
|
||||
|
||||
from_address = getattr(task_backend, "from_address")
|
||||
from_address = email.utils.formataddr((user.username, from_address))
|
||||
return (from_address, task_backend)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue