pallets-eco / flask-session

Server side session extension for Flask
https://flask-session.readthedocs.io
BSD 3-Clause "New" or "Revised" License
488 stars 236 forks source link

Flask session does not work with Flask 3.0 and Werkzeug 3.0 #206

Closed mrestivill closed 5 months ago

mrestivill commented 6 months ago

The first request accessing the session fails:

  File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1270, in process_response
    self.session_interface.save_session(self, ctx.session, response)
  File "/usr/local/lib/python3.9/site-packages/flask_session/sessions.py", line 164, in save_session
    response.set_cookie(app.config["SESSION_COOKIE_NAME"], session_id,
  File "/usr/local/lib/python3.9/site-packages/werkzeug/sansio/response.py", line 224, in set_cookie
    dump_cookie(
  File "/usr/local/lib/python3.9/site-packages/werkzeug/http.py", line 1303, in dump_cookie
    if not _cookie_no_quote_re.fullmatch(value):
TypeError: cannot use a string pattern on a bytes-like object
placetne commented 6 months ago

This has been fixed in the pull request https://github.com/pallets-eco/flask-session/pull/194 and merged to the main branch. But the update has not been released yet.

vittxr commented 5 months ago

as @placetne mentioned, the update has not been released yet. I solve this just copying the content of the 'sessions.py' file from repo directory 'src/flask_session/sessions.py' and pasting it into the corresponding file in my local 'flask_session' folder

Lxstr commented 5 months ago

Closed for 0.6.0