Merge branch 'sleekslush-master'

main
Vincent Driessen 13 years ago
commit 0b66bbaab1

@ -11,11 +11,11 @@ class NoRedisConnectionException(Exception):
def Connection(connection=None): def Connection(connection=None):
if connection is None: if connection is None:
connection = Redis() connection = Redis()
_connection_stack.push(connection) push_connection(connection)
try: try:
yield yield
finally: finally:
popped = _connection_stack.pop() popped = pop_connection()
assert popped == connection, \ assert popped == connection, \
'Unexpected Redis connection was popped off the stack. ' \ 'Unexpected Redis connection was popped off the stack. ' \
'Check your Redis connection setup.' 'Check your Redis connection setup.'
@ -41,7 +41,7 @@ def use_connection(redis=None):
if redis is None: if redis is None:
redis = Redis() redis = Redis()
_connection_stack.push(redis) push_connection(redis)
def get_current_connection(): def get_current_connection():

Loading…
Cancel
Save