Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions flask_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
_app_ctx_stack = None

import redis
from flask import _request_ctx_stack
from flask.globals import request_ctx
from werkzeug.utils import import_string


Expand All @@ -40,8 +40,7 @@
# Default Redis connection class
RedisClass = redis.Redis if IS_REDIS3 else redis.StrictRedis

# Which stack should we use? _app_ctx_stack is new in 0.9
connection_stack = _app_ctx_stack or _request_ctx_stack
connection_stack = request_ctx


class Redis(object):
Expand Down Expand Up @@ -83,7 +82,7 @@ def get_app(self):
accessing Redis connection public methods via plugin.
"""
# First see to connection stack
ctx = connection_stack.top
ctx = connection_stack
if ctx is not None:
return ctx.app

Expand Down