From 8c1f8e54cdb97a6bb4bf8523c05ec1b783e7a283 Mon Sep 17 00:00:00 2001 From: Ross Lawley Date: Mon, 28 Jan 2013 14:12:47 +0000 Subject: [PATCH] Added the "get_decoded" method to the MongoSession class (#216) --- AUTHORS | 3 ++- docs/changelog.rst | 1 + docs/upgrade.rst | 2 +- mongoengine/django/sessions.py | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index ac811dd1..64f0b0a2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -138,4 +138,5 @@ that much better: * Manuel Hermann * Gustavo Gawryszewski * Max Countryman - * caitifbrito \ No newline at end of file + * caitifbrito + * lcya86 刘春洋 \ No newline at end of file diff --git a/docs/changelog.rst b/docs/changelog.rst index 8b41d6ee..65561544 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -44,6 +44,7 @@ Changes in 0.8.X - Added Django Group and Permission (#142) - Added Doc class and pk to Validation messages (#69) - 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 ================ diff --git a/docs/upgrade.rst b/docs/upgrade.rst index fcd5f714..8724503d 100644 --- a/docs/upgrade.rst +++ b/docs/upgrade.rst @@ -298,5 +298,5 @@ Alternatively, you can rename your collections eg :: 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. diff --git a/mongoengine/django/sessions.py b/mongoengine/django/sessions.py index 17cae8ad..1c9288ed 100644 --- a/mongoengine/django/sessions.py +++ b/mongoengine/django/sessions.py @@ -25,6 +25,7 @@ MONGOENGINE_SESSION_DATA_ENCODE = getattr( settings, 'MONGOENGINE_SESSION_DATA_ENCODE', True) + class MongoSession(Document): session_key = fields.StringField(primary_key=True, max_length=40) session_data = fields.StringField() if MONGOENGINE_SESSION_DATA_ENCODE \ @@ -34,7 +35,7 @@ class MongoSession(Document): meta = {'collection': MONGOENGINE_SESSION_COLLECTION, 'db_alias': MONGOENGINE_SESSION_DB_ALIAS, 'allow_inheritance': False} - + def get_decoded(self): return SessionStore().decode(self.session_data)