From 1994cd14f22f9574ce80f75698a4e53c49a8d5a8 Mon Sep 17 00:00:00 2001 From: Jhansi M N S <94177510+jhanm12@users.noreply.github.com> Date: Fri, 2 Feb 2024 19:44:09 +0530 Subject: [PATCH] Update flask_redis.py --- flask_redis.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/flask_redis.py b/flask_redis.py index 25af387..c9dca19 100644 --- a/flask_redis.py +++ b/flask_redis.py @@ -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 @@ -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): @@ -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