Formatting

This commit is contained in:
Scot Hacker 2019-04-12 00:09:01 -07:00
parent 4a385bde6b
commit befc7ad2cd
28 changed files with 253 additions and 311 deletions

View file

@ -1,8 +1,9 @@
import importlib
def _declare_backend(backend_path):
backend_path = backend_path.split('.')
backend_module_name = '.'.join(backend_path[:-1])
backend_path = backend_path.split(".")
backend_module_name = ".".join(backend_path[:-1])
class_name = backend_path[-1]
def backend(*args, headers={}, from_address=None, **kwargs):
@ -17,9 +18,10 @@ def _declare_backend(backend_path):
_backend.from_address = from_address
_backend.headers = headers
return _backend
return backend
smtp_backend = _declare_backend('django.core.mail.backends.smtp.EmailBackend')
console_backend = _declare_backend('django.core.mail.backends.console.EmailBackend')
locmem_backend = _declare_backend('django.core.mail.backends.locmem.EmailBackend')
smtp_backend = _declare_backend("django.core.mail.backends.smtp.EmailBackend")
console_backend = _declare_backend("django.core.mail.backends.console.EmailBackend")
locmem_backend = _declare_backend("django.core.mail.backends.locmem.EmailBackend")

View file

@ -70,14 +70,12 @@ def imap_producer(
try:
yield message
except Exception:
logger.exception(
f"something went wrong while processing {message_uid}"
)
logger.exception(f"something went wrong while processing {message_uid}")
raise
if not preserve:
# tag the message for deletion
conn.store(message_uid, '+FLAGS', '\\Deleted')
conn.store(message_uid, "+FLAGS", "\\Deleted")
else:
logger.debug("did not receive any message")
finally: