Fixed #17810 (again). Catch session key errors.
The previous commit didn't work with PyLibMC. This solution appears to be the best compromise at this point in the 1.4 release cycle. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
46871eb1bb
commit
f356a2e52f
|
@ -19,10 +19,9 @@ class SessionStore(SessionBase):
|
||||||
def load(self):
|
def load(self):
|
||||||
try:
|
try:
|
||||||
session_data = self._cache.get(self.cache_key, None)
|
session_data = self._cache.get(self.cache_key, None)
|
||||||
except Exception, e:
|
except Exception:
|
||||||
e_type = str(type(e))
|
# Some backends (e.g. memcache) raise an exception on invalid
|
||||||
if e_type != "<class 'memcache.MemcachedKeyLengthError'>":
|
# cache keys. If this happens, reset the session. See #17810.
|
||||||
raise e
|
|
||||||
session_data = None
|
session_data = None
|
||||||
if session_data is not None:
|
if session_data is not None:
|
||||||
return session_data
|
return session_data
|
||||||
|
|
|
@ -24,10 +24,9 @@ class SessionStore(DBStore):
|
||||||
def load(self):
|
def load(self):
|
||||||
try:
|
try:
|
||||||
data = cache.get(self.cache_key, None)
|
data = cache.get(self.cache_key, None)
|
||||||
except Exception, e:
|
except Exception:
|
||||||
e_type = str(type(e))
|
# Some backends (e.g. memcache) raise an exception on invalid
|
||||||
if e_type != "<class 'memcache.MemcachedKeyLengthError'>":
|
# cache keys. If this happens, reset the session. See #17810.
|
||||||
raise e
|
|
||||||
data = None
|
data = None
|
||||||
if data is None:
|
if data is None:
|
||||||
data = super(SessionStore, self).load()
|
data = super(SessionStore, self).load()
|
||||||
|
|
Loading…
Reference in New Issue