diff --git a/rq/job.py b/rq/job.py index 856890f..90c3a0e 100644 --- a/rq/job.py +++ b/rq/job.py @@ -49,7 +49,7 @@ class Job(object): keyword arguments. """ connection = kwargs.pop('connection', None) - job = Job(connection=connection) + job = cls(connection=connection) job._func_name = '%s.%s' % (func.__module__, func.__name__) job._args = args job._kwargs = kwargs @@ -89,7 +89,7 @@ class Job(object): """Fetches a persisted job from its corresponding Redis key and instantiates it. """ - job = Job(id, connection=connection) + job = cls(id, connection=connection) job.refresh() return job diff --git a/rq/queue.py b/rq/queue.py index 6940b9b..3377be8 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -40,7 +40,7 @@ class Queue(object): if not queue_key.startswith(prefix): raise ValueError('Not a valid RQ queue key: %s' % (queue_key,)) name = queue_key[len(prefix):] - return Queue(name, connection=connection) + return cls(name, connection=connection) def __init__(self, name='default', default_timeout=None, connection=None): if connection is None: @@ -209,7 +209,7 @@ class Queue(object): if result is None: return None queue_key, job_id = result - queue = Queue.from_queue_key(queue_key, connection=connection) + queue = cls.from_queue_key(queue_key, connection=connection) try: job = Job.fetch(job_id, connection=connection) except NoSuchJobError: diff --git a/rq/worker.py b/rq/worker.py index ce368f1..fc8c790 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -73,7 +73,7 @@ class Worker(object): return None name = worker_key[len(prefix):] - worker = Worker([], name) + worker = cls([], name) queues = conn.hget(worker.key, 'queues') worker._state = conn.hget(worker.key, 'state') or '?' if queues: