Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues with loading session using sqlalchemy backend #26

Closed
markosski opened this issue Oct 28, 2015 · 3 comments
Closed

Having issues with loading session using sqlalchemy backend #26

markosski opened this issue Oct 28, 2015 · 3 comments

Comments

@markosski
Copy link

I noticed there was a fix added for Python 3 to the way session string is handled but I'm still having problems.
data = self.serializer.loads(want_bytes(val)) When this line executes in open_session I'm still not getting my session back. I poked around I noticed pickle is raising exception of type _pickle.UnpicklingError with no message to it.

Python 3.4.0
SQLAlchemy 0.9.8 + MySQL 5.5
Flask 0.10.1

@markosski
Copy link
Author

In order to make it work I had to do the following changes.

  • in class Session data column was changed to data = self.db.Column(self.db.BLOB)
  • in open_session method unserializing changed to data = self.serializer.loads(val)
  • in open_session when testing for expiration added test for existence of vlaue if saved_session and saved_session.expiry != None and saved_session.expiry <= datetime.utcnow(): This is because upon calling session.clear() in application self.get_expiration_time(app, session) returns None and expiry will be set to Null in database.

@mcrowson

This comment was marked as outdated.

@Lxstr
Copy link
Contributor

Lxstr commented Feb 26, 2024

Fixed post 0.6.0

@Lxstr Lxstr closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants