Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #4729 -- SessionWrapper.pop now sets modified flag if necessary…

…. Thanks, Ben Slavin, SmileyChris and Collin Grady

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5592 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f9a592d99d3ed689ed757ba2a18007e277c7db1d 1 parent 179f478
Adrian Holovaty adrianholovaty authored
1  django/contrib/sessions/middleware.py
View
@@ -37,6 +37,7 @@ def get(self, key, default=None):
return self._session.get(key, default)
def pop(self, key, *args):
+ self.modified = self.modified or key in self._session
return self._session.pop(key, *args)
def set_test_cookie(self):
16 django/contrib/sessions/tests.py
View
@@ -5,8 +5,24 @@
>>> s._session_cache = {}
>>> s._session_cache['some key'] = 'exists'
+>>> s.accessed
+False
+>>> s.modified
+False
+
+>>> s.pop('non existant key', 'does not exist')
+'does not exist'
+>>> s.accessed
+True
+>>> s.modified
+False
+
>>> s.pop('some key')
'exists'
+>>> s.accessed
+True
+>>> s.modified
+True
>>> s.pop('some key', 'does not exist')
'does not exist'
Please sign in to comment.
Something went wrong with that request. Please try again.