mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-21 23:43:11 +01:00
Add user defined IMAP Debug Level and improved exception message
This commit is contained in:
parent
a8fbeaa140
commit
c23c8e5be6
@ -251,8 +251,7 @@ def imap_oauth_sync(q, logger, server):
|
||||
include_client_id=True,
|
||||
)
|
||||
|
||||
# TODO: Somehow link this to the debug level set within Django settings logging
|
||||
server.debug = 4
|
||||
server.debug = settings.HELPDESK_IMAP_DEBUG_LEVEL
|
||||
|
||||
# TODO: Perhaps store the authentication string template externally? Settings? Queue Table?
|
||||
server.authenticate(
|
||||
@ -263,15 +262,14 @@ def imap_oauth_sync(q, logger, server):
|
||||
# Select the Inbound Mailbox folder
|
||||
server.select(q.email_box_imap_folder)
|
||||
|
||||
except imaplib.IMAP4.abort:
|
||||
logger.error("IMAP authentication failed.")
|
||||
except imaplib.IMAP4.abort as e1:
|
||||
logger.error(f"IMAP authentication failed in OAUTH: {e1}", exc_info=True)
|
||||
server.logout()
|
||||
sys.exit()
|
||||
|
||||
except ssl.SSLError:
|
||||
except ssl.SSLError as e2:
|
||||
logger.error(
|
||||
"IMAP login failed due to SSL error. This is often due to a timeout. "
|
||||
"Please check your connection and try again."
|
||||
f"IMAP login failed due to SSL error. (This is often due to a timeout): {e2}", exc_info=True
|
||||
)
|
||||
server.logout()
|
||||
sys.exit()
|
||||
|
@ -262,3 +262,6 @@ HELPDESK_OAUTH = getattr(
|
||||
"scope": [""]
|
||||
}
|
||||
)
|
||||
|
||||
# Set Debug Logging Level for IMAP Services. Default to '0' for No Debugging
|
||||
HELPDESK_IMAP_DEBUG_LEVEL = getattr(settings, 'HELPDESK_IMAP_DEBUG_LEVEL', 0)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -109,7 +109,9 @@ class QuickDjangoTest:
|
||||
HELPDESK_TEAMS_MIGRATION_DEPENDENCIES=[],
|
||||
HELPDESK_KBITEM_TEAM_GETTER=lambda _: None,
|
||||
# test the API
|
||||
HELPDESK_ACTIVATE_API_ENDPOINT=True
|
||||
HELPDESK_ACTIVATE_API_ENDPOINT=True,
|
||||
# Set IMAP Server Debug Verbosity
|
||||
HELPDESK_IMAP_DEBUG_LEVEL=int(os.environ.get("HELPDESK_IMAP_DEBUG_LEVEL", "0")),
|
||||
)
|
||||
|
||||
from django.test.runner import DiscoverRunner
|
||||
|
Loading…
Reference in New Issue
Block a user