From b5feeb7ee95704124047f6e1bbb55b57b5096190 Mon Sep 17 00:00:00 2001 From: Jonathan Barratt Date: Fri, 13 Jan 2017 17:06:11 +0700 Subject: [PATCH] Make SOCKS-proxy support global for all queues under Py3 Python 2 retains per-queue SOCKS-proxy support, but this is simplest fix until someone needs it for Python 3. --- docs/configuration.rst | 2 +- helpdesk/management/commands/get_email.py | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index d9a67b29..8c30b5f9 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -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 `_. You're now up and running! Happy ticketing. diff --git a/helpdesk/management/commands/get_email.py b/helpdesk/management/commands/get_email.py index 0bf4c0a3..90916a72 100644 --- a/helpdesk/management/commands/get_email.py +++ b/helpdesk/management/commands/get_email.py @@ -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