Add simple helper function, to avoid users to learn about the `conn`

stack.

This makes it easier to start using the product.
main
Vincent Driessen 13 years ago
parent 0ff2984adf
commit a491ff248d

@ -1,5 +1,13 @@
from redis import Redis
from .proxy import conn
from .queue import Queue
from .worker import Worker
__all__ = ['conn', 'Queue', 'Worker']
def use_redis(redis=None):
if redis is None:
redis = Redis()
elif not isinstance(redis, Redis):
raise TypeError('Argument redis should be a Redis instance.')
conn.push(redis)
__all__ = ['conn', 'Queue', 'Worker', 'use_redis']

Loading…
Cancel
Save