@@ -224,6 +224,14 @@ def get_cookie_samesite(self, app: Flask) -> str | None:
224224 """
225225 return app .config ["SESSION_COOKIE_SAMESITE" ] # type: ignore[no-any-return]
226226
227+ def get_cookie_partitioned (self , app : Flask ) -> bool :
228+ """Returns True if the cookie should be partitioned. By default, uses
229+ the value of :data:`SESSION_COOKIE_PARTITIONED`.
230+
231+ .. versionadded:: 3.1
232+ """
233+ return app .config ["SESSION_COOKIE_PARTITIONED" ] # type: ignore[no-any-return]
234+
227235 def get_expiration_time (self , app : Flask , session : SessionMixin ) -> datetime | None :
228236 """A helper method that returns an expiration date for the session
229237 or ``None`` if the session is linked to the browser session. The
@@ -338,6 +346,7 @@ def save_session(
338346 domain = self .get_cookie_domain (app )
339347 path = self .get_cookie_path (app )
340348 secure = self .get_cookie_secure (app )
349+ partitioned = self .get_cookie_partitioned (app )
341350 samesite = self .get_cookie_samesite (app )
342351 httponly = self .get_cookie_httponly (app )
343352
@@ -354,6 +363,7 @@ def save_session(
354363 domain = domain ,
355364 path = path ,
356365 secure = secure ,
366+ partitioned = partitioned ,
357367 samesite = samesite ,
358368 httponly = httponly ,
359369 )
@@ -374,6 +384,7 @@ def save_session(
374384 domain = domain ,
375385 path = path ,
376386 secure = secure ,
387+ partitioned = partitioned ,
377388 samesite = samesite ,
378389 )
379390 response .vary .add ("Cookie" )
0 commit comments