From 0a2aed38d28c570ddcbbcee3803ce928794f554c Mon Sep 17 00:00:00 2001 From: Eagllus Date: Tue, 6 Feb 2018 11:17:09 +0100 Subject: [PATCH 1/3] Fix Python3 only code. Thanks to @P-EB for providing the solution --- django_q/queues.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/django_q/queues.py b/django_q/queues.py index ad729a1b..20f082f9 100644 --- a/django_q/queues.py +++ b/django_q/queues.py @@ -1,6 +1,7 @@ """ The code is derived from https://github.com/althonos/pronto/commit/3384010dfb4fc7c66a219f59276adef3288a886b """ +import sys import multiprocessing import multiprocessing.queues @@ -48,7 +49,11 @@ class Queue(multiprocessing.queues.Queue): """ def __init__(self, *args, **kwargs): - super(Queue, self).__init__(*args, ctx=multiprocessing.get_context(), **kwargs) + if sys.version_info < (3, 0): + super(Queue, self).__init__(*args, **kwargs) + else: + super(Queue, self).__init__(*args, ctx=multiprocessing.get_context(), **kwargs) + self.size = SharedCounter(0) def put(self, *args, **kwargs): From 3f6c0f76a677cc5ac39edc5af548dae4c065fb57 Mon Sep 17 00:00:00 2001 From: Eagllus Date: Tue, 6 Feb 2018 11:18:42 +0100 Subject: [PATCH 2/3] Fix super call to work with Python 2.x --- django_q/core_signing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_q/core_signing.py b/django_q/core_signing.py index 1790a0bb..c433c83c 100644 --- a/django_q/core_signing.py +++ b/django_q/core_signing.py @@ -62,7 +62,7 @@ def unsign(self, value, max_age=None): Retrieve original value and check it wasn't signed more than max_age seconds ago. """ - result = super().unsign(value) + result = super(TimestampSigner, self).unsign(value) value, timestamp = result.rsplit(self.sep, 1) timestamp = baseconv.base62.decode(timestamp) if max_age is not None: From 319ab90fabc01cbc4949b3930fdba18032e28ef9 Mon Sep 17 00:00:00 2001 From: Eagllus Date: Tue, 6 Feb 2018 16:14:05 +0100 Subject: [PATCH 3/3] Add checks back for Python 2.7 but don't run them with Django 2 --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 269d24fa..991ec239 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ services: - mongodb python: + - "2.7" - "3.6" env: @@ -12,6 +13,11 @@ env: - DJANGO=1.11.9 - DJANGO=1.8.18 +matrix: + exclude: + - python: "2.7" + env: DJANGO=2.0 + sudo: false addons: