Permalink
Browse files

Fixing sessions for django 1.3 and django 1.4

  • Loading branch information...
1 parent 88dc646 commit a9280471475baec4bcc92e46937b8016479dfc06 @rozza rozza committed Apr 24, 2012
Showing with 16 additions and 1 deletion.
  1. +1 −1 mongoengine/django/sessions.py
  2. +15 −0 tests/django_tests.py
@@ -44,7 +44,7 @@ def exists(self, session_key):
def create(self):
while True:
- self.session_key = self._get_new_session_key()
+ self._session_key = self._get_new_session_key()
try:
self.save(must_create=True)
except CreateError:
View
@@ -12,6 +12,10 @@
settings.configure()
+from django.contrib.sessions.tests import SessionTestsMixin
+from mongoengine.django.sessions import SessionStore, MongoSession
+
+
class QuerySetTest(unittest.TestCase):
def setUp(self):
@@ -88,3 +92,14 @@ class Page(Document):
end = p * 2
start = end - 1
self.assertEqual(t.render(Context(d)), u'%d:%d:' % (start, end))
+
+
+
+class MongoDBSessionTest(SessionTestsMixin, unittest.TestCase):
+ backend = SessionStore
+
+ def setUp(self):
+ connect(db='mongoenginetest')
+ MongoSession.drop_collection()
+ super(MongoDBSessionTest, self).setUp()
+

0 comments on commit a928047

Please sign in to comment.