Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit f356a2e52fd0c36045b960412196552944a57888 1 parent 46871eb
@aaugustin aaugustin authored
View
7 django/contrib/sessions/backends/cache.py
@@ -19,10 +19,9 @@ def cache_key(self):
def load(self):
try:
session_data = self._cache.get(self.cache_key, None)
- except Exception, e:
- e_type = str(type(e))
- if e_type != "<class 'memcache.MemcachedKeyLengthError'>":
- raise e
+ except Exception:
+ # Some backends (e.g. memcache) raise an exception on invalid
+ # cache keys. If this happens, reset the session. See #17810.
session_data = None
if session_data is not None:
return session_data
View
7 django/contrib/sessions/backends/cached_db.py
@@ -24,10 +24,9 @@ def cache_key(self):
def load(self):
try:
data = cache.get(self.cache_key, None)
- except Exception, e:
- e_type = str(type(e))
- if e_type != "<class 'memcache.MemcachedKeyLengthError'>":
- raise e
+ except Exception:
+ # Some backends (e.g. memcache) raise an exception on invalid
+ # cache keys. If this happens, reset the session. See #17810.
data = None
if data is None:
data = super(SessionStore, self).load()
Please sign in to comment.
Something went wrong with that request. Please try again.