pallets-eco / flask-session

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

MongoDBSessionInterface does not work on Python 3.x #7

Closed ntamas closed 9 years ago

ntamas commented 9 years ago

MongoDBSessionInterface does not work on Python 3.x due to an exception being raised when the session is read back from MongoDB. This happens due to the str() call in line 401 of sessions.py in the current head (see https://github.com/fengsp/flask-session/blob/master/flask_session/sessions.py#L401), since type(document['val']) == bytes, and casting it to a str makes it unsuitable for pickle.loads. Removing the call to str() resolves the problem.