Fix formatting

This commit is contained in:
Christopher Broderick 2023-10-24 14:08:40 +01:00
parent 4f65d9cd8e
commit a7863b5f27

View File

@ -57,7 +57,7 @@ STRIPPED_SUBJECT_STRINGS = [
HTML_EMAIL_ATTACHMENT_FILENAME = _("email_html_body.html")
def process_email(quiet: bool =False, debug_to_stdout=False):
def process_email(quiet: bool = False, debug_to_stdout: bool = False):
if debug_to_stdout:
print("Extracting email into queues...")
q: Queue() # Typing ahead of time for loop to make it more useful in an IDE
@ -66,8 +66,7 @@ def process_email(quiet: bool =False, debug_to_stdout=False):
allow_email_submission=True):
log_msg = f"Processing queue: {q.slug} Email address: {q.email_address}..."
if debug_to_stdout:
print(log_msg )
print(log_msg)
logger = logging.getLogger('django.helpdesk.queue.' + q.slug)
logging_types = {
'info': logging.INFO,
@ -103,11 +102,11 @@ def process_email(quiet: bool =False, debug_to_stdout=False):
if logger.isEnabledFor(logger.INFO):
logger.info(log_msg)
if debug_to_stdout:
print(log_msg )
except Exception as e:
logger.error("Queue processing failed: {q.slug}", exc_info=True)
print(log_msg)
except Exception:
logger.error("Queue processing failed: {q.slug} -- {e}", exc_info=True)
if debug_to_stdout:
print(f"Queue processing failed: {q.slug}" )
print(f"Queue processing failed: {q.slug}")
print("-"*60)
traceback.print_exc(file=sys.stdout)
finally: