Fixed #1339 -- Added keys() and items() methods to session objects. Thanks, Ned Batchelder

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2300 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-10 21:33:07 +00:00
parent d8b4d29004
commit bf16befc43
3 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,7 @@ answer newbie questions, and generally made Django that much better:
David Ascher <http://ascher.ca/> David Ascher <http://ascher.ca/>
Arthur <avandorp@gmail.com> Arthur <avandorp@gmail.com>
Jiri Barton Jiri Barton
Ned Batchelder <http://www.nedbatchelder.com/>
James Bennett James Bennett
Paul Bissex <http://e-scribe.com/> Paul Bissex <http://e-scribe.com/>
Simon Blanchard Simon Blanchard

View File

@ -25,6 +25,12 @@ class SessionWrapper(object):
del self._session[key] del self._session[key]
self.modified = True self.modified = True
def keys(self):
return self._session.keys()
def items(self):
return self._session.items()
def get(self, key, default=None): def get(self, key, default=None):
return self._session.get(key, default) return self._session.get(key, default)

View File

@ -50,6 +50,12 @@ It implements the following standard dictionary methods:
* ``get(key, default=None)`` * ``get(key, default=None)``
Example: ``fav_color = request.session.get('fav_color', 'red')`` Example: ``fav_color = request.session.get('fav_color', 'red')``
* ``keys()``
**New in Django development version.**
* ``items()``
**New in Django development version.**
It also has these three methods: It also has these three methods:
* ``set_test_cookie()`` * ``set_test_cookie()``