|
|
|
@ -10,6 +10,7 @@
|
|
|
|
|
""" |
|
|
|
|
import os |
|
|
|
|
import sys |
|
|
|
|
import warnings |
|
|
|
|
from datetime import timedelta |
|
|
|
|
from functools import update_wrapper |
|
|
|
|
from itertools import chain |
|
|
|
@ -925,8 +926,17 @@ class Flask(_PackageBoundObject):
|
|
|
|
|
:attr:`secret_key` is set. Instead of overriding this method |
|
|
|
|
we recommend replacing the :class:`session_interface`. |
|
|
|
|
|
|
|
|
|
.. deprecated: 1.0 |
|
|
|
|
Will be removed in 1.1. Use ``session_interface.open_session`` |
|
|
|
|
instead. |
|
|
|
|
|
|
|
|
|
:param request: an instance of :attr:`request_class`. |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
warnings.warn(DeprecationWarning( |
|
|
|
|
'"open_session" is deprecated and will be removed in 1.1. Use' |
|
|
|
|
' "session_interface.open_session" instead.' |
|
|
|
|
)) |
|
|
|
|
return self.session_interface.open_session(self, request) |
|
|
|
|
|
|
|
|
|
def save_session(self, session, response): |
|
|
|
@ -934,19 +944,37 @@ class Flask(_PackageBoundObject):
|
|
|
|
|
implementation, check :meth:`open_session`. Instead of overriding this |
|
|
|
|
method we recommend replacing the :class:`session_interface`. |
|
|
|
|
|
|
|
|
|
.. deprecated: 1.0 |
|
|
|
|
Will be removed in 1.1. Use ``session_interface.save_session`` |
|
|
|
|
instead. |
|
|
|
|
|
|
|
|
|
:param session: the session to be saved (a |
|
|
|
|
:class:`~werkzeug.contrib.securecookie.SecureCookie` |
|
|
|
|
object) |
|
|
|
|
:param response: an instance of :attr:`response_class` |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
warnings.warn(DeprecationWarning( |
|
|
|
|
'"save_session" is deprecated and will be removed in 1.1. Use' |
|
|
|
|
' "session_interface.save_session" instead.' |
|
|
|
|
)) |
|
|
|
|
return self.session_interface.save_session(self, session, response) |
|
|
|
|
|
|
|
|
|
def make_null_session(self): |
|
|
|
|
"""Creates a new instance of a missing session. Instead of overriding |
|
|
|
|
this method we recommend replacing the :class:`session_interface`. |
|
|
|
|
|
|
|
|
|
.. deprecated: 1.0 |
|
|
|
|
Will be removed in 1.1. Use ``session_interface.make_null_session`` |
|
|
|
|
instead. |
|
|
|
|
|
|
|
|
|
.. versionadded:: 0.7 |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
warnings.warn(DeprecationWarning( |
|
|
|
|
'"make_null_session" is deprecated and will be removed in 1.1. Use' |
|
|
|
|
' "session_interface.make_null_session" instead.' |
|
|
|
|
)) |
|
|
|
|
return self.session_interface.make_null_session(self) |
|
|
|
|
|
|
|
|
|
@setupmethod |
|
|
|
@ -1932,7 +1960,7 @@ class Flask(_PackageBoundObject):
|
|
|
|
|
for handler in funcs: |
|
|
|
|
response = handler(response) |
|
|
|
|
if not self.session_interface.is_null_session(ctx.session): |
|
|
|
|
self.save_session(ctx.session, response) |
|
|
|
|
self.session_interface.save_session(self, ctx.session, response) |
|
|
|
|
return response |
|
|
|
|
|
|
|
|
|
def do_teardown_request(self, exc=_sentinel): |
|
|
|
|