Rename the const.

main
Vincent Driessen 12 years ago
parent 538bbb1b55
commit 5e59c6e28e

@ -1,12 +1,12 @@
from functools import wraps from functools import wraps
from .queue import Queue from .queue import Queue
from .connections import resolve_connection from .connections import resolve_connection
from .worker import DEF_TTL from .worker import DEFAULT_RESULT_TTL
class job(object): class job(object):
def __init__(self, queue, connection=None, timeout=None, def __init__(self, queue, connection=None, timeout=None,
result_ttl=DEF_TTL): result_ttl=DEFAULT_RESULT_TTL):
"""A decorator that adds a ``delay`` method to the decorated function, """A decorator that adds a ``delay`` method to the decorated function,
which in turn creates a RQ job when called. Accepts a required which in turn creates a RQ job when called. Accepts a required
``queue`` argument that can be either a ``Queue`` instance or a string ``queue`` argument that can be either a ``Queue`` instance or a string

@ -29,7 +29,7 @@ green = make_colorizer('darkgreen')
yellow = make_colorizer('darkyellow') yellow = make_colorizer('darkyellow')
blue = make_colorizer('darkblue') blue = make_colorizer('darkblue')
DEF_TTL = 500 DEFAULT_RESULT_TTL = 500
class StopRequested(Exception): class StopRequested(Exception):
pass pass
@ -97,7 +97,7 @@ class Worker(object):
return worker return worker
def __init__(self, queues, name=None, default_result_ttl=DEF_TTL, def __init__(self, queues, name=None, default_result_ttl=DEFAULT_RESULT_TTL,
connection=None, exc_handler=None): # noqa connection=None, exc_handler=None): # noqa
if connection is None: if connection is None:
connection = get_current_connection() connection = get_current_connection()

@ -3,7 +3,7 @@ from tests.fixtures import decorated_job
from rq.decorators import job from rq.decorators import job
from rq.job import Job from rq.job import Job
from rq.worker import DEF_TTL from rq.worker import DEFAULT_RESULT_TTL
class TestDecorator(RQTestCase): class TestDecorator(RQTestCase):
@ -41,7 +41,7 @@ class TestDecorator(RQTestCase):
""" """
#Ensure default #Ensure default
result = decorated_job.delay(1, 2) result = decorated_job.delay(1, 2)
self.assertEqual(result.result_ttl, DEF_TTL) self.assertEqual(result.result_ttl, DEFAULT_RESULT_TTL)
@job('default', result_ttl=10) @job('default', result_ttl=10)
def hello(): def hello():

Loading…
Cancel
Save