forked from orbit-oss/flask
parent
5978a0f55f
commit
6637e20174
2 changed files with 15 additions and 8 deletions
19
flask/ctx.py
19
flask/ctx.py
|
|
@ -325,15 +325,18 @@ class RequestContext(object):
|
|||
|
||||
_request_ctx_stack.push(self)
|
||||
|
||||
# Open the session at the moment that the request context is
|
||||
# available. This allows a custom open_session method to use the
|
||||
# request context (e.g. code that access database information
|
||||
# stored on `g` instead of the appcontext).
|
||||
session_interface = self.app.session_interface
|
||||
self.session = session_interface.open_session(self.app, self.request)
|
||||
|
||||
# Open the session at the moment that the request context is available.
|
||||
# This allows a custom open_session method to use the request context.
|
||||
# Only open a new session if this is the first time the request was
|
||||
# pushed, otherwise stream_with_context loses the session.
|
||||
if self.session is None:
|
||||
self.session = session_interface.make_null_session(self.app)
|
||||
session_interface = self.app.session_interface
|
||||
self.session = session_interface.open_session(
|
||||
self.app, self.request
|
||||
)
|
||||
|
||||
if self.session is None:
|
||||
self.session = session_interface.make_null_session(self.app)
|
||||
|
||||
def pop(self, exc=_sentinel):
|
||||
"""Pops the request context and unbinds it by doing that. This will
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue