From b263b22cca1212f1a4f2f835f0b4cad9630acfd8 Mon Sep 17 00:00:00 2001 From: Michael Huang Date: Tue, 14 Feb 2017 14:58:16 -0800 Subject: [PATCH] Wrap message.encode() in conditional for Python 2 --- helpdesk/management/commands/get_email.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpdesk/management/commands/get_email.py b/helpdesk/management/commands/get_email.py index 26c63a73..c48da611 100644 --- a/helpdesk/management/commands/get_email.py +++ b/helpdesk/management/commands/get_email.py @@ -260,7 +260,7 @@ def decode_mail_headers(string): def ticket_from_message(message, queue, logger): # 'message' must be an RFC822 formatted message. - message = email.message_from_string(message.encode('utf-8')) + message = email.message_from_string(message.encode('utf-8') if six.PY2 else message) subject = message.get('subject', _('Created from e-mail')) subject = decode_mail_headers(decodeUnknown(message.get_charset(), subject)) for affix in STRIPPED_SUBJECT_STRINGS: