Opened 7 years ago

Closed 7 years ago

#7429 closed (fixed)

Make SessionBase more dictionary-like

Reported by: jdunck Owned by: nobody
Component: contrib.sessions Version: master
Severity: Keywords:
Cc: davidgouldin@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

SessionBase is missing the following dictionary methods:

>>> engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])
>>> session = engine.SessionStore(None)
>>> set(dir(dict)) - set(dir(session))
set(['__ne__', '__ge__', 'fromkeys', '__eq__', 'clear', '__gt__', 'update', '__cmp__', '__le__', '__iter__', 'has_key', 'values', 'iterkeys', 'itervalues', 'iteritems', '__lt__', 'copy', 'popitem', '__len__'])

This patch adds support for update, has_key, values, iterkeys, itervalues, and iteritems.

Includes tests.

Attachments (2)

session-dictlike.diff (2.4 KB) - added by jdunck 7 years ago.
As of Django svn 7543.
session-dictlike.2.diff (2.4 KB) - added by jdunck 7 years ago.
Fixed .update to take kwargs.

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by jdunck

As of Django svn 7543.

comment:1 Changed 7 years ago by jdunck

  • Cc davidgouldin@… added

Changed 7 years ago by jdunck

Fixed .update to take kwargs.

comment:2 Changed 7 years ago by Simon Greenhill

  • Has patch set
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:3 Changed 7 years ago by russellm

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

(In [7687]) Fixed #7429 -- Modified the Session base class a little more dictionary-like by adding update(), has_key(), values(), and iterator access methods. Thanks to Jeremy Dunck for the suggestion and patch.

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