Skip to content

Commit

Permalink
Unicode bug fixed. Version 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Yurchenko committed Apr 9, 2013
1 parent c52dc74 commit 8abb6d7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.2.1
- Bug with Unicode values in session dictionary fixed (issue #8)

0.2
- API changed a little
- Bugfixes
Expand Down
5 changes: 5 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ the collection with specified name.
Changes
-------

0.2.1
`````

- Bug with Unicode values in session dictionary fixed

0.2
```

Expand Down
8 changes: 5 additions & 3 deletions flask_mongo_sessions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from datetime import datetime
from datetime import timedelta

from bson.binary import Binary

from werkzeug.datastructures import CallbackDict
from flask.sessions import SessionMixin
from flask.sessions import SessionInterface
Expand All @@ -19,8 +21,8 @@ def on_update(this):
self.new = new
self.modified = False

def pickle(self):
return pickle.dumps(dict(self))
def pack(self):
return Binary(pickle.dumps(dict(self)))


class MongoDBSessionInterface(SessionInterface):
Expand Down Expand Up @@ -80,7 +82,7 @@ def save_session(self, app, session, response):
self.__get_collection().update(
{'_id': session.sid},
{'$set': {
'd': session.pickle(),
'd': session.pack(),
'exp': session_exp,
}},
upsert=True)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='flask-mongo-sessions',
version='0.2',
version='0.2.1',
url='https://github.com/ivanyu/flask-mongo-sessions',
license='MIT',
author='Ivan Yurchenko',
Expand Down

0 comments on commit 8abb6d7

Please sign in to comment.