Ticket #7515: session_clear.diff
File session_clear.diff, 1014 bytes (added by , 16 years ago) |
---|
-
django/contrib/sessions/tests.py
147 147 >>> list(i) 148 148 [('x', 1)] 149 149 150 # test .clear() 151 >>> s.modified = s.accessed = False 152 >>> s.items() 153 [('x', 1)] 154 >>> s.clear() 155 >>> s.items() 156 [] 157 >>> s.accessed, s.modified 158 (True, True) 150 159 151 160 152 161 ######################### -
django/contrib/sessions/backends/base.py
52 52 self.modified = self.modified or key in self._session 53 53 return self._session.pop(key, *args) 54 54 55 def clear(self): 56 self._session.clear() 57 self.modified = True 58 55 59 def setdefault(self, key, value): 56 60 if key in self._session: 57 61 return self._session[key]