MCPcopy
hub / github.com/pallets/flask / should_set_cookie

Method should_set_cookie

src/flask/sessions.py:233–247  ·  view source on GitHub ↗

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

(self, app: Flask, session: SessionMixin)

Source from the content-addressed store, hash-verified

231 return None
232
233 def should_set_cookie(self, app: Flask, session: SessionMixin) -> bool:
234 """Used by session backends to determine if a ``Set-Cookie`` header
235 should be set for this session cookie for this response. If the session
236 has been modified, the cookie is set. If the session is permanent and
237 the ``SESSION_REFRESH_EACH_REQUEST`` config is true, the cookie is
238 always set.
239
240 This check is usually skipped if the session was deleted.
241
242 .. versionadded:: 0.11
243 """
244
245 return session.modified or (
246 session.permanent and app.config["SESSION_REFRESH_EACH_REQUEST"]
247 )
248
249 def open_session(self, app: Flask, request: Request) -> SessionMixin | None:
250 """This is called at the beginning of each request, after

Callers 1

save_sessionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected