Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #1137 -- Added a _contains_() method to SessionWrapper. Thanks,…

… Brant

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1793 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f7f812cd7087625266f69596fb914a919bc798ae 1 parent 632914f
@adrianholovaty adrianholovaty authored
Showing with 6 additions and 0 deletions.
  1. +3 −0  django/middleware/sessions.py
  2. +3 −0  docs/sessions.txt
View
3  django/middleware/sessions.py
@@ -11,6 +11,9 @@ def __init__(self, session_key):
self.session_key = session_key
self.modified = False
+ def __contains__(self, key):
+ return key in self._session
+
def __getitem__(self, key):
return self._session[key]
View
3  docs/sessions.txt
@@ -34,6 +34,9 @@ it and write to it.
It implements the following standard dictionary methods:
+ * ``__contains__(key)``
+ **New in Django development version.** Example: ``'fav_color' in request.session``
+
* ``__getitem__(key)``
Example: ``fav_color = request.session['fav_color']``
Please sign in to comment.
Something went wrong with that request. Please try again.