Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python3 only code #292

Merged
merged 3 commits into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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