Ticket #4729: sessionwrapper_pop_modified.3.patch
File sessionwrapper_pop_modified.3.patch, 1.1 KB (added by , 17 years ago) |
---|
-
django/contrib/sessions/middleware.py
37 37 return self._session.get(key, default) 38 38 39 39 def pop(self, key, *args): 40 self.modified = self.modified or key in self._session 40 41 return self._session.pop(key, *args) 41 42 42 43 def set_test_cookie(self): -
django/contrib/sessions/tests.py
5 5 >>> s._session_cache = {} 6 6 >>> s._session_cache['some key'] = 'exists' 7 7 8 >>> s.accessed 9 False 10 >>> s.modified 11 False 12 13 >>> s.pop('non existant key', 'does not exist') 14 'does not exist' 15 >>> s.accessed 16 True 17 >>> s.modified 18 False 19 8 20 >>> s.pop('some key') 9 21 'exists' 22 >>> s.accessed 23 True 24 >>> s.modified 25 True 10 26 11 27 >>> s.pop('some key', 'does not exist') 12 28 'does not exist'