Opened 16 years ago

Closed 16 years ago

#7429 closed (fixed)

Make SessionBase more dictionary-like

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


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 Jeremy Dunck 16 years ago.
As of Django svn 7543.
session-dictlike.2.diff (2.4 KB ) - added by Jeremy Dunck 16 years ago.
Fixed .update to take kwargs.

Download all attachments as: .zip

Change History (5)

by Jeremy Dunck, 16 years ago

Attachment: session-dictlike.diff added

As of Django svn 7543.

comment:1 by Jeremy Dunck, 16 years ago

Cc: davidgouldin@… added

by Jeremy Dunck, 16 years ago

Attachment: session-dictlike.2.diff added

Fixed .update to take kwargs.

comment:2 by Simon Greenhill, 16 years ago

Has patch: set
Triage Stage: UnreviewedReady for checkin

comment:3 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(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