Skip to content

Commit

Permalink
[frontend/flask] fix session_cookie_name deprecation
Browse files Browse the repository at this point in the history
Updated setup requirements to Flask 2.0+ that introduces the new
function.

Fix #942
  • Loading branch information
anthonygego committed May 5, 2023
1 parent ddbb756 commit 73b9768
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions inginious/frontend/flask/mongo_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def open_session(self, app, request):
sid = None
else:
cookieless = False
sid = request.cookies.get(app.session_cookie_name)
sid = request.cookies.get(self.get_cookie_name(app))

if not sid:
sid = self._generate_sid()
Expand Down Expand Up @@ -124,8 +124,7 @@ def save_session(self, app, session, response):
if not session:
if session.modified:
self.store.delete_one({'_id': store_id})
response.delete_cookie(app.session_cookie_name,
domain=domain, path=path)
response.delete_cookie(self.get_cookie_name(app), domain=domain, path=path)
return

httponly = self.get_cookie_httponly(app)
Expand All @@ -141,6 +140,6 @@ def save_session(self, app, session, response):
else:
session_id = session.sid
if not cookieless:
response.set_cookie(app.session_cookie_name, session_id,
response.set_cookie(self.get_cookie_name(app), session_id,
expires=expires, httponly=httponly,
domain=domain, path=path, secure=secure)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"WsgiDAV >= 3.0.0",
"Werkzeug >= 1.0.0",
"itsdangerous >= 1.1.0",
"Flask >= 1.1.0",
"Flask >= 2.0.0",
"Flask-Mail >= 0.9.1",
"importlib_metadata >= 3.7.0",
'dataclasses >= 0.8; python_version < "3.7.0"',
Expand Down

0 comments on commit 73b9768

Please sign in to comment.