Skip to content

Add support for flask-session 0.8.0+#40348

Closed
tirkarthi wants to merge 4 commits intoapache:mainfrom
tirkarthi:flask-sessions-upgrade
Closed

Add support for flask-session 0.8.0+#40348
tirkarthi wants to merge 4 commits intoapache:mainfrom
tirkarthi:flask-sessions-upgrade

Conversation

@tirkarthi
Copy link
Contributor

@tirkarthi tirkarthi commented Jun 20, 2024

Opening this PR for running CI tests. Changes are as follows :

  • import path changed
  • db renamed to client
  • encode method changed to dumps
  • decode method changed to loads
  • flask-session creates session table by default so migration is removed to avoid duplicate table error.

Issues :

  • serialization tests fail since flask_session switched to msgpack by default from pickle which causes objects that were compatible with pickle like flask's flash message objects to fail in the test since msgpack doesn't know how to serialize them.
  • It seems after the release of 0.8.0 the methods encode/decode were again changed to dumps/loads in pallets-eco/flask-session@0c22ec6 . This will cause an issue moving to 0.8.0+ since there is no compatibility layer between two methods.

closes: #36897
related: #36897

@boring-cyborg boring-cyborg bot added the area:webserver Webserver related Issues label Jun 20, 2024
@tirkarthi
Copy link
Contributor Author

serialization tests fail since flask_session switched to msgpack by default from pickle which causes objects that were compatible with pickle like flask's flash message objects to fail in the test since msgpack doesn't know how to serialize them.

@tirkarthi tirkarthi force-pushed the flask-sessions-upgrade branch from 2a43eb8 to 8c815eb Compare June 30, 2024 07:48
@tirkarthi
Copy link
Contributor Author

I tried changing the serializer to pickle but one of the objects has a function defined inside __init__ which cannot be serialized by pickle. I have implemented a custom serializer extending it to serialize and deserialize markup objects.

https://jcristharif.com/msgspec/extending.html#defining-a-custom-extension-messagepack-only

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Aug 15, 2024
@github-actions github-actions bot closed this Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webserver Webserver related Issues stale Stale PRs per the .github/workflows/stale.yml policy file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Flask-sesssion 0.6.0+

1 participant