Fixed potential circular import problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14564 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b6ec268e23
commit
f6363bc628
|
@ -1,11 +1,11 @@
|
||||||
import datetime
|
import datetime
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.sessions.models import Session
|
|
||||||
from django.contrib.sessions.backends.base import SessionBase, CreateError
|
from django.contrib.sessions.backends.base import SessionBase, CreateError
|
||||||
from django.core.exceptions import SuspiciousOperation
|
from django.core.exceptions import SuspiciousOperation
|
||||||
from django.db import IntegrityError, transaction, router
|
from django.db import IntegrityError, transaction, router
|
||||||
from django.utils.encoding import force_unicode
|
from django.utils.encoding import force_unicode
|
||||||
|
|
||||||
|
|
||||||
class SessionStore(SessionBase):
|
class SessionStore(SessionBase):
|
||||||
"""
|
"""
|
||||||
Implements database session store.
|
Implements database session store.
|
||||||
|
@ -76,3 +76,7 @@ class SessionStore(SessionBase):
|
||||||
Session.objects.get(session_key=session_key).delete()
|
Session.objects.get(session_key=session_key).delete()
|
||||||
except Session.DoesNotExist:
|
except Session.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# At bottom to avoid circular import
|
||||||
|
from django.contrib.sessions.models import Session
|
||||||
|
|
|
@ -4,6 +4,7 @@ import cPickle as pickle
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
class SessionManager(models.Manager):
|
class SessionManager(models.Manager):
|
||||||
def encode(self, session_dict):
|
def encode(self, session_dict):
|
||||||
"""
|
"""
|
||||||
|
@ -51,4 +52,6 @@ class Session(models.Model):
|
||||||
def get_decoded(self):
|
def get_decoded(self):
|
||||||
return SessionStore().decode(self.session_data)
|
return SessionStore().decode(self.session_data)
|
||||||
|
|
||||||
|
|
||||||
|
# At bottom to avoid circular import
|
||||||
from django.contrib.sessions.backends.db import SessionStore
|
from django.contrib.sessions.backends.db import SessionStore
|
||||||
|
|
Loading…
Reference in New Issue