should_set_cookie() — flask Function Reference
Architecture documentation for the should_set_cookie() function in sessions.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 2cf7467e_84a3_e5f7_ca7c_32bde50158e9["should_set_cookie()"] bbf56873_bd71_6e70_f44c_ca8a85b0a007["SessionInterface"] 2cf7467e_84a3_e5f7_ca7c_32bde50158e9 -->|defined in| bbf56873_bd71_6e70_f44c_ca8a85b0a007 58643c3f_4184_c18b_8361_a7d628d93359["save_session()"] 58643c3f_4184_c18b_8361_a7d628d93359 -->|calls| 2cf7467e_84a3_e5f7_ca7c_32bde50158e9 style 2cf7467e_84a3_e5f7_ca7c_32bde50158e9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/flask/sessions.py lines 247–261
def should_set_cookie(self, app: Flask, session: SessionMixin) -> bool:
"""Used by session backends to determine if a ``Set-Cookie`` header
should be set for this session cookie for this response. If the session
has been modified, the cookie is set. If the session is permanent and
the ``SESSION_REFRESH_EACH_REQUEST`` config is true, the cookie is
always set.
This check is usually skipped if the session was deleted.
.. versionadded:: 0.11
"""
return session.modified or (
session.permanent and app.config["SESSION_REFRESH_EACH_REQUEST"]
)
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does should_set_cookie() do?
should_set_cookie() is a function in the flask codebase, defined in src/flask/sessions.py.
Where is should_set_cookie() defined?
should_set_cookie() is defined in src/flask/sessions.py at line 247.
What calls should_set_cookie()?
should_set_cookie() is called by 1 function(s): save_session.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free