Opened 5 years ago

Closed 5 years ago

Last modified 3 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:


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


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

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 5 years ago by mtredinnick

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

Backport of r9934 from trunk.

comment:4 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.