Commit f356a2e5 authored by Aymeric Augustin's avatar Aymeric Augustin
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
parent 46871eb1
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -19,10 +19,9 @@ class SessionStore(SessionBase):
    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
+3 −4
Original line number Diff line number Diff line
@@ -24,10 +24,9 @@ class SessionStore(DBStore):
    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()