mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-21 23:43:11 +01:00
Address bytes/str issue with POP3 email in get_email script, to address #565
This commit is contained in:
parent
1bd88c0f4f
commit
8f375e1379
@ -158,7 +158,17 @@ def process_queue(q, logger):
|
||||
messagesInfo = server.list()[1]
|
||||
logger.info("Received %d messages from POP3 server" % len(messagesInfo))
|
||||
|
||||
for msg in messagesInfo:
|
||||
for msgRaw in messagesInfo:
|
||||
if six.PY3:
|
||||
# in py3, msgRaw is a bytes object, decode to str
|
||||
try:
|
||||
msg = msgRaw.decode("utf-8")
|
||||
except:
|
||||
# if couldn't decode easily, just leave it raw
|
||||
msg = msgRaw
|
||||
else:
|
||||
# in py2, already a str
|
||||
msg = msgRaw
|
||||
msgNum = msg.split(" ")[0]
|
||||
logger.info("Processing message %s" % msgNum)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user