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.
This commit is contained in:
Jonathan Barratt 2017-01-13 17:06:11 +07:00
parent 719b03f186
commit b5feeb7ee9
No known key found for this signature in database
GPG Key ID: C007F833B47313DA
2 changed files with 3 additions and 7 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:
elif six.PY2:
socket.socket = socket._socketobject
elif six.PY3:
import _socket
socket.socket = _socket.socket
email_box_type = settings.QUEUE_EMAIL_BOX_TYPE or q.email_box_type