Method: flask.sessions.SessionInterface.should_set_cookie
Calls: 58, Exceptions: 0, Paths: 2Back
Path 1: 40 calls (0.69)
Flask (38) test_session_dynamic_cookie_name.
SecureCookieSession (40)
True (40)
1def should_set_cookie(self, app: Flask, session: SessionMixin) -> bool:
2 """Used by session backends to determine if a ``Set-Cookie`` header
3 should be set for this session cookie for this response. If the session
4 has been modified, the cookie is set. If the session is permanent and
5 the ``SESSION_REFRESH_EACH_REQUEST`` config is true, the cookie is
6 always set.
7
8 This check is usually skipped if the session was deleted.
9
10 .. versionadded:: 0.11
11 """
12
13 return session.modified or (
14 session.permanent and app.config["SESSION_REFRESH_EACH_REQUEST"]
15 )
Path 2: 18 calls (0.31)
Flask (16) test_session_dynamic_cookie_name.
SecureCookieSession (18)
False (15) True (3)
1def should_set_cookie(self, app: Flask, session: SessionMixin) -> bool:
2 """Used by session backends to determine if a ``Set-Cookie`` header
3 should be set for this session cookie for this response. If the session
4 has been modified, the cookie is set. If the session is permanent and
5 the ``SESSION_REFRESH_EACH_REQUEST`` config is true, the cookie is
6 always set.
7
8 This check is usually skipped if the session was deleted.
9
10 .. versionadded:: 0.11
11 """
12
13 return session.modified or (
14 session.permanent and app.config["SESSION_REFRESH_EACH_REQUEST"]
15 )