From f5779c194f88b633be8e29d3b7e5660da2525b9d Mon Sep 17 00:00:00 2001 From: foxx Date: Mon, 8 Sep 2014 12:19:59 +0100 Subject: [PATCH] Renamed job_id to id, and fixed py3 bug, per #415 --- rq/job.py | 10 +++++----- rq/queue.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rq/job.py b/rq/job.py index ddaa750..d9e93a6 100644 --- a/rq/job.py +++ b/rq/job.py @@ -95,7 +95,7 @@ class Job(object): @classmethod def create(cls, func, args=None, kwargs=None, connection=None, result_ttl=None, status=None, description=None, depends_on=None, timeout=None, - job_id=None): + id=None): """Creates a new Job instance for the given function, arguments, and keyword arguments. """ @@ -108,12 +108,12 @@ class Job(object): raise TypeError('{0!r} is not a valid args list.'.format(args)) if not isinstance(kwargs, dict): raise TypeError('{0!r} is not a valid kwargs dict.'.format(kwargs)) - if not isinstance(job_id, (str, unicode, types.NoneType)): - raise TypeError('job_id must be a str/unicode, not {0}.'.format(type(job_id))) + if not isinstance(id, (string_types, types.NoneType)): + raise TypeError('id must be a string, not {0}.'.format(type(id))) job = cls(connection=connection) - if job_id is not None: - job.set_id(job_id) + if id is not None: + job.set_id(id) # Set the core job tuple properties job._instance = None diff --git a/rq/queue.py b/rq/queue.py index 608f609..1d77b78 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -164,7 +164,7 @@ class Queue(object): def enqueue_call(self, func, args=None, kwargs=None, timeout=None, result_ttl=None, description=None, depends_on=None, - job_id=None): + id=None): """Creates a job to represent the delayed function call and enqueues it. @@ -178,7 +178,7 @@ class Queue(object): job = self.job_class.create(func, args, kwargs, connection=self.connection, result_ttl=result_ttl, status=Status.QUEUED, description=description, depends_on=depends_on, timeout=timeout, - job_id=job_id) + id=id) # If job depends on an unfinished job, register itself on it's # parent's dependents instead of enqueueing it. @@ -234,7 +234,7 @@ class Queue(object): return self.enqueue_call(func=f, args=args, kwargs=kwargs, timeout=timeout, result_ttl=result_ttl, description=description, depends_on=depends_on, - job_id=job_id) + id=job_id) def enqueue_job(self, job, set_meta_data=True): """Enqueues a job for delayed execution.