Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#9548 closed (fixed)

Cache Backend for Sessions doesn't handle Empty Session State

Reported by: kevin.a.stone@… Owned by: nobody
Component: contrib.sessions Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The exists method in the SessionStore in the cache backend's test returns a session does not exist if nothing is stored in the session. I'm am trying to develop a site that just uses the SessionMiddleware to track visitors and doesn't actually store anything in the session. This will potential create collisions with existing visitors since exists() will return that the newly generated session key is available when it actually is not...

Change from:

    def exists(self, session_key):
        if self._cache.get(session_key):
            return True
        return False

To:

    def exists(self, session_key):
        if self._cache.has_key(session_key):
            return True
        return False

Change History (4)

comment:1 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:2 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [9934]) Fixed #9548 -- Correctly detect existence of empty sessions with cache backend.

comment:3 by Malcolm Tredinnick, 16 years ago

(In [9935]) [1.0.X] Fixed #9548 -- Correctly detect existence of empty sessions with cache backend.

Backport of r9934 from trunk.

comment:4 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top