From d38649792a47f8fff33783d37fdea4f8c0703c3a Mon Sep 17 00:00:00 2001 From: Dave Chevell Date: Sat, 6 Oct 2018 12:45:57 +1000 Subject: [PATCH] Add session to copy_current_request_context --- flask/ctx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flask/ctx.py b/flask/ctx.py index 8472c920..cfed561b 100644 --- a/flask/ctx.py +++ b/flask/ctx.py @@ -14,7 +14,7 @@ from functools import update_wrapper from werkzeug.exceptions import HTTPException -from .globals import _request_ctx_stack, _app_ctx_stack +from .globals import session, _request_ctx_stack, _app_ctx_stack from .signals import appcontext_pushed, appcontext_popped from ._compat import BROKEN_PYPY_CTXMGR_EXIT, reraise @@ -147,6 +147,7 @@ def copy_current_request_context(f): 'when a request context is on the stack. For instance within ' 'view functions.') reqctx = top.copy() + reqctx.session = session.copy() def wrapper(*args, **kwargs): with reqctx: return f(*args, **kwargs)