mirror of https://github.com/django/django.git
Removed trailing whitespace in django/contrib/sessions/backends/base.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6388 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3db846cdb5
commit
79dead9a24
|
@ -16,7 +16,6 @@ class SessionBase(object):
|
||||||
"""
|
"""
|
||||||
Base class for all Session classes.
|
Base class for all Session classes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
TEST_COOKIE_NAME = 'testcookie'
|
TEST_COOKIE_NAME = 'testcookie'
|
||||||
TEST_COOKIE_VALUE = 'worked'
|
TEST_COOKIE_VALUE = 'worked'
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ class SessionBase(object):
|
||||||
|
|
||||||
def delete_test_cookie(self):
|
def delete_test_cookie(self):
|
||||||
del self[self.TEST_COOKIE_NAME]
|
del self[self.TEST_COOKIE_NAME]
|
||||||
|
|
||||||
def encode(self, session_dict):
|
def encode(self, session_dict):
|
||||||
"Returns the given session dictionary pickled and encoded as a string."
|
"Returns the given session dictionary pickled and encoded as a string."
|
||||||
pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)
|
pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)
|
||||||
|
@ -77,7 +76,7 @@ class SessionBase(object):
|
||||||
# just return an empty dictionary (an empty session).
|
# just return an empty dictionary (an empty session).
|
||||||
except:
|
except:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def _get_new_session_key(self):
|
def _get_new_session_key(self):
|
||||||
"Returns session key that isn't being used."
|
"Returns session key that isn't being used."
|
||||||
# The random module is seeded when this Apache child is created.
|
# The random module is seeded when this Apache child is created.
|
||||||
|
@ -93,17 +92,17 @@ class SessionBase(object):
|
||||||
if not self.exists(session_key):
|
if not self.exists(session_key):
|
||||||
break
|
break
|
||||||
return session_key
|
return session_key
|
||||||
|
|
||||||
def _get_session_key(self):
|
def _get_session_key(self):
|
||||||
if self._session_key:
|
if self._session_key:
|
||||||
return self._session_key
|
return self._session_key
|
||||||
else:
|
else:
|
||||||
self._session_key = self._get_new_session_key()
|
self._session_key = self._get_new_session_key()
|
||||||
return self._session_key
|
return self._session_key
|
||||||
|
|
||||||
def _set_session_key(self, session_key):
|
def _set_session_key(self, session_key):
|
||||||
self._session_key = session_key
|
self._session_key = session_key
|
||||||
|
|
||||||
session_key = property(_get_session_key, _set_session_key)
|
session_key = property(_get_session_key, _set_session_key)
|
||||||
|
|
||||||
def _get_session(self):
|
def _get_session(self):
|
||||||
|
@ -119,9 +118,9 @@ class SessionBase(object):
|
||||||
return self._session_cache
|
return self._session_cache
|
||||||
|
|
||||||
_session = property(_get_session)
|
_session = property(_get_session)
|
||||||
|
|
||||||
# Methods that child classes must implement.
|
# Methods that child classes must implement.
|
||||||
|
|
||||||
def exists(self, session_key):
|
def exists(self, session_key):
|
||||||
"""
|
"""
|
||||||
Returns True if the given session_key already exists.
|
Returns True if the given session_key already exists.
|
||||||
|
@ -145,4 +144,3 @@ class SessionBase(object):
|
||||||
Loads the session data and returns a dictionary.
|
Loads the session data and returns a dictionary.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue