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

Method get_expiration_time

src/flask/sessions.py:223–231  ·  view source on GitHub ↗

A helper method that returns an expiration date for the session or ``None`` if the session is linked to the browser session. The default implementation returns now + the permanent session lifetime configured on the application.

(self, app: Flask, session: SessionMixin)

Source from the content-addressed store, hash-verified

221 return app.config["SESSION_COOKIE_PARTITIONED"] # type: ignore[no-any-return]
222
223 def get_expiration_time(self, app: Flask, session: SessionMixin) -> datetime | None:
224 """A helper method that returns an expiration date for the session
225 or ``None`` if the session is linked to the browser session. The
226 default implementation returns now + the permanent session
227 lifetime configured on the application.
228 """
229 if session.permanent:
230 return datetime.now(timezone.utc) + app.permanent_session_lifetime
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

Callers 1

save_sessionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected