mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-25 09:23:39 +01:00
Fix formatting
This commit is contained in:
parent
4f65d9cd8e
commit
a7863b5f27
@ -57,17 +57,16 @@ STRIPPED_SUBJECT_STRINGS = [
|
|||||||
HTML_EMAIL_ATTACHMENT_FILENAME = _("email_html_body.html")
|
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:
|
if debug_to_stdout:
|
||||||
print("Extracting email into queues...")
|
print("Extracting email into queues...")
|
||||||
q: Queue() # Typing ahead of time for loop to make it more useful in an IDE
|
q: Queue() # Typing ahead of time for loop to make it more useful in an IDE
|
||||||
for q in Queue.objects.filter(
|
for q in Queue.objects.filter(
|
||||||
email_box_type__isnull=False,
|
email_box_type__isnull=False,
|
||||||
allow_email_submission=True):
|
allow_email_submission=True):
|
||||||
log_msg = f"Processing queue: {q.slug} Email address: {q.email_address}..."
|
log_msg = f"Processing queue: {q.slug} Email address: {q.email_address}..."
|
||||||
if debug_to_stdout:
|
if debug_to_stdout:
|
||||||
print(log_msg )
|
print(log_msg)
|
||||||
|
|
||||||
logger = logging.getLogger('django.helpdesk.queue.' + q.slug)
|
logger = logging.getLogger('django.helpdesk.queue.' + q.slug)
|
||||||
logging_types = {
|
logging_types = {
|
||||||
'info': logging.INFO,
|
'info': logging.INFO,
|
||||||
@ -103,11 +102,11 @@ def process_email(quiet: bool =False, debug_to_stdout=False):
|
|||||||
if logger.isEnabledFor(logger.INFO):
|
if logger.isEnabledFor(logger.INFO):
|
||||||
logger.info(log_msg)
|
logger.info(log_msg)
|
||||||
if debug_to_stdout:
|
if debug_to_stdout:
|
||||||
print(log_msg )
|
print(log_msg)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logger.error("Queue processing failed: {q.slug}", exc_info=True)
|
logger.error("Queue processing failed: {q.slug} -- {e}", exc_info=True)
|
||||||
if debug_to_stdout:
|
if debug_to_stdout:
|
||||||
print(f"Queue processing failed: {q.slug}" )
|
print(f"Queue processing failed: {q.slug}")
|
||||||
print("-"*60)
|
print("-"*60)
|
||||||
traceback.print_exc(file=sys.stdout)
|
traceback.print_exc(file=sys.stdout)
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user