Added the "get_decoded" method to the MongoSession class (#216)

This commit is contained in:
Ross Lawley 2013-01-28 14:12:47 +00:00
parent 03d3c26a99
commit 8c1f8e54cd
4 changed files with 6 additions and 3 deletions

View File

@ -138,4 +138,5 @@ that much better:
* Manuel Hermann * Manuel Hermann
* Gustavo Gawryszewski * Gustavo Gawryszewski
* Max Countryman * Max Countryman
* caitifbrito * caitifbrito
* lcya86 刘春洋

View File

@ -44,6 +44,7 @@ Changes in 0.8.X
- Added Django Group and Permission (#142) - Added Django Group and Permission (#142)
- Added Doc class and pk to Validation messages (#69) - Added Doc class and pk to Validation messages (#69)
- Fixed Documents deleted via a queryset don't call any signals (#105) - Fixed Documents deleted via a queryset don't call any signals (#105)
- Added the "get_decoded" method to the MongoSession class (#216)
Changes in 0.7.9 Changes in 0.7.9
================ ================

View File

@ -298,5 +298,5 @@ Alternatively, you can rename your collections eg ::
mongodb 1.8 > 2.0 + mongodb 1.8 > 2.0 +
=================== ===================
Its been reported that indexes may need to be recreated to the newer version of indexes. Its been reported that indexes may need to be recreated to the newer version of indexes.
To do this drop indexes and call ``ensure_indexes`` on each model. To do this drop indexes and call ``ensure_indexes`` on each model.

View File

@ -25,6 +25,7 @@ MONGOENGINE_SESSION_DATA_ENCODE = getattr(
settings, 'MONGOENGINE_SESSION_DATA_ENCODE', settings, 'MONGOENGINE_SESSION_DATA_ENCODE',
True) True)
class MongoSession(Document): class MongoSession(Document):
session_key = fields.StringField(primary_key=True, max_length=40) session_key = fields.StringField(primary_key=True, max_length=40)
session_data = fields.StringField() if MONGOENGINE_SESSION_DATA_ENCODE \ session_data = fields.StringField() if MONGOENGINE_SESSION_DATA_ENCODE \
@ -34,7 +35,7 @@ class MongoSession(Document):
meta = {'collection': MONGOENGINE_SESSION_COLLECTION, meta = {'collection': MONGOENGINE_SESSION_COLLECTION,
'db_alias': MONGOENGINE_SESSION_DB_ALIAS, 'db_alias': MONGOENGINE_SESSION_DB_ALIAS,
'allow_inheritance': False} 'allow_inheritance': False}
def get_decoded(self): def get_decoded(self):
return SessionStore().decode(self.session_data) return SessionStore().decode(self.session_data)