Changeset 6889
- Timestamp:
- 12/04/07 14:24:22 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/contrib/sessions/backends/file.py
r6348 r6889 1 1 import os 2 import tempfile 2 3 from django.conf import settings 3 4 from django.contrib.sessions.backends.base import SessionBase 4 from django.core.exceptions import SuspiciousOperation 5 from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured 5 6 6 7 class SessionStore(SessionBase): … … 9 10 """ 10 11 def __init__(self, session_key=None): 11 self.storage_path = settings.SESSION_FILE_PATH 12 self.storage_path = getattr(settings, "SESSION_FILE_PATH", tempfile.gettempdir()) 13 14 # Make sure the storage path is valid. 15 if not os.path.isdir(self.storage_path): 16 raise ImproperlyConfigured("The session storage path %r doesn't exist. "\ 17 "Please set your SESSION_FILE_PATH setting "\ 18 "to an existing directory in which Django "\ 19 "can store session data." % self.storage_path) 20 12 21 self.file_prefix = settings.SESSION_COOKIE_NAME 13 22 super(SessionStore, self).__init__(session_key)
