forked from extern/django-helpdesk
Fix formatting per flake8
This commit is contained in:
parent
b78be0d71f
commit
8d7ba415fa
@ -212,7 +212,7 @@ def imap_sync(q, logger, server):
|
|||||||
"Successfully processed message %s, deleted from IMAP server" % num)
|
"Successfully processed message %s, deleted from IMAP server" % num)
|
||||||
else:
|
else:
|
||||||
logger.warn(
|
logger.warn(
|
||||||
"Message %s was not successfully processed, and will be left on IMAP server" % num)
|
"Message %s was not successfully processed, and will be left on IMAP server" % num)
|
||||||
except imaplib.IMAP4.error:
|
except imaplib.IMAP4.error:
|
||||||
logger.error(
|
logger.error(
|
||||||
"IMAP retrieve failed. Is the folder '%s' spelled correctly, and does it exist on the server?",
|
"IMAP retrieve failed. Is the folder '%s' spelled correctly, and does it exist on the server?",
|
||||||
@ -595,20 +595,22 @@ def get_email_body_from_part_payload(part) -> str:
|
|||||||
part.get_payload(decode=False)
|
part.get_payload(decode=False)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def attempt_body_extract_from_html(message: str) -> str:
|
def attempt_body_extract_from_html(message: str) -> str:
|
||||||
mail = BeautifulSoup(str(message), "html.parser")
|
mail = BeautifulSoup(str(message), "html.parser")
|
||||||
beautiful_body = mail.find('body')
|
beautiful_body = mail.find('body')
|
||||||
body = None
|
body = None
|
||||||
full_body = None
|
full_body = None
|
||||||
if beautiful_body:
|
if beautiful_body:
|
||||||
try:
|
try:
|
||||||
body = beautiful_body.text
|
body = beautiful_body.text
|
||||||
full_body = body
|
full_body = body
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
if not body:
|
if not body:
|
||||||
body = ""
|
body = ""
|
||||||
return body, full_body
|
return body, full_body
|
||||||
|
|
||||||
|
|
||||||
def extract_part_data(
|
def extract_part_data(
|
||||||
part: Message,
|
part: Message,
|
||||||
@ -616,7 +618,7 @@ def extract_part_data(
|
|||||||
ticket_id: int,
|
ticket_id: int,
|
||||||
files: List,
|
files: List,
|
||||||
logger: logging.Logger
|
logger: logging.Logger
|
||||||
) -> Tuple[str, str]:
|
) -> Tuple[str, str]:
|
||||||
name = part.get_filename()
|
name = part.get_filename()
|
||||||
if name:
|
if name:
|
||||||
name = email.utils.collapse_rfc2231_value(name)
|
name = email.utils.collapse_rfc2231_value(name)
|
||||||
@ -682,6 +684,7 @@ def extract_part_data(
|
|||||||
logger.debug("Found MIME attachment %s", name)
|
logger.debug("Found MIME attachment %s", name)
|
||||||
return part_body, part_full_body
|
return part_body, part_full_body
|
||||||
|
|
||||||
|
|
||||||
def object_from_message(message: str,
|
def object_from_message(message: str,
|
||||||
queue: Queue,
|
queue: Queue,
|
||||||
logger: logging.Logger
|
logger: logging.Logger
|
||||||
|
Loading…
Reference in New Issue
Block a user