Skip to content

Commit

Permalink
Merge pull request #292 from Eagllus/fix_python3_only_code
Browse files Browse the repository at this point in the history
Fix python3 only code
  • Loading branch information
Koed00 authored Feb 12, 2018
2 parents 67ba251 + 319ab90 commit 3ba32a3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ services:
- mongodb

python:
- "2.7"
- "3.6"

env:
- DJANGO=2.0
- DJANGO=1.11.9
- DJANGO=1.8.18

matrix:
exclude:
- python: "2.7"
env: DJANGO=2.0

sudo: false

addons:
Expand Down
2 changes: 1 addition & 1 deletion django_q/core_signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion django_q/queues.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
The code is derived from https://github.com/althonos/pronto/commit/3384010dfb4fc7c66a219f59276adef3288a886b
"""
import sys

import multiprocessing
import multiprocessing.queues
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 3ba32a3

Please sign in to comment.