Merge pull request #477 from reduxionist/issue/474

Merge SOCKS is for all-or-no queues only for Py3 and improved handling of imap encoding errors
This commit is contained in:
Jonathan Barratt 2017-01-17 12:54:54 +07:00 committed by GitHub
commit 7c5daa26ea
2 changed files with 4 additions and 8 deletions

View File

@ -39,6 +39,6 @@ Before django-helpdesk will be much use, you need to do some basic configuration
EMAIL_HOST_USER = 'YYYYYY@ZZZZ.PPP'
EMAIL_HOST_PASSWORD = '123456'
8. If you wish to use SOCKS4/5 proxy with Helpdesk Queue email operations, install PySocks manually.
8. If you wish to use SOCKS4/5 proxy with Helpdesk Queue email operations, install PySocks manually. Please note that mixing both SOCKS and non-SOCKS email sources for different queues is only supported under Python 2; on Python 3, SOCKS proxy support is all-or-nothing: either all queue email sources must use SOCKS or none may use it. If you need this functionality on Python 3 please `let us know <https://github.com/django-helpdesk/django-helpdesk/issues/new>`_.
You're now up and running! Happy ticketing.

View File

@ -126,12 +126,8 @@ def process_queue(q, logger):
addr=q.socks_proxy_host,
port=q.socks_proxy_port)
socket.socket = socks.socksocket
else:
if six.PY2:
socket.socket = socket._socketobject
elif six.PY3:
import _socket
socket.socket = _socket.socket
elif six.PY2:
socket.socket = socket._socketobject
email_box_type = settings.QUEUE_EMAIL_BOX_TYPE or q.email_box_type
@ -202,7 +198,7 @@ def process_queue(q, logger):
for num in msgnums:
logger.info("Processing message %s" % num)
status, data = server.fetch(num, '(RFC822)')
ticket = ticket_from_message(message=encoding.smart_text(data[0][1]), queue=q, logger=logger)
ticket = ticket_from_message(message=encoding.smart_text(data[0][1], errors='replace'), queue=q, logger=logger)
if ticket:
server.store(num, '+FLAGS', '\\Deleted')
logger.info("Successfully processed message %s, deleted from IMAP server" % num)