diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-02-10 21:33:07 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-02-10 21:33:07 +0000 |
| commit | bf16befc433ff9e1764db0fa57ef05b507eee0e0 (patch) | |
| tree | 495f6d35917b25f7ea5e35aa4499913333867468 | |
| parent | d8b4d29004d518459a74c5b588d3455da2871e42 (diff) | |
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
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | django/middleware/sessions.py | 6 | ||||
| -rw-r--r-- | docs/sessions.txt | 6 |
3 files changed, 13 insertions, 0 deletions
@@ -36,6 +36,7 @@ answer newbie questions, and generally made Django that much better: David Ascher <http://ascher.ca/> Arthur <avandorp@gmail.com> Jiri Barton + Ned Batchelder <http://www.nedbatchelder.com/> James Bennett Paul Bissex <http://e-scribe.com/> Simon Blanchard diff --git a/django/middleware/sessions.py b/django/middleware/sessions.py index d6d25de276..e6fa7d742d 100644 --- a/django/middleware/sessions.py +++ b/django/middleware/sessions.py @@ -25,6 +25,12 @@ class SessionWrapper(object): del self._session[key] self.modified = True + def keys(self): + return self._session.keys() + + def items(self): + return self._session.items() + def get(self, key, default=None): return self._session.get(key, default) diff --git a/docs/sessions.txt b/docs/sessions.txt index d3d1873a9a..6a208a1461 100644 --- a/docs/sessions.txt +++ b/docs/sessions.txt @@ -50,6 +50,12 @@ It implements the following standard dictionary methods: * ``get(key, default=None)`` 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: * ``set_test_cookie()`` |
