Opened 8 years ago

Closed 8 years ago

Last modified 5 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: UI/UX:

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 Changed 8 years ago by Jacob

milestone: 1.1
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

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

comment:3 Changed 8 years ago by Malcolm Tredinnick

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

Backport of r9934 from trunk.

comment:4 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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