Ticket #6984: load_session_before_save.diff
File load_session_before_save.diff, 2.1 KB (added by , 16 years ago) |
---|
-
django/contrib/sessions/backends/base.py
217 217 """ 218 218 Saves the session data. 219 219 """ 220 # Avoid race conditions, see #6984. Make sure the session dict is 221 # loaded into memory before saving it back. 222 self._get_session() 223 self._save() 224 225 def _save(self): 226 """ 227 The actual saving function that has to be overridden by backends. 228 """ 220 229 raise NotImplementedError 221 230 222 231 def delete(self, session_key): -
django/contrib/sessions/backends/file.py
60 60 pass 61 61 return session_data 62 62 63 def save(self):63 def _save(self): 64 64 try: 65 65 f = open(self._key_to_file(self.session_key), "wb") 66 66 try: -
django/contrib/sessions/backends/cache.py
13 13 session_data = self._cache.get(self.session_key) 14 14 return session_data or {} 15 15 16 def save(self):16 def _save(self): 17 17 self._cache.set(self.session_key, self._session, self.get_expiry_age()) 18 18 19 19 def exists(self, session_key): -
django/contrib/sessions/backends/db.py
36 36 return False 37 37 return True 38 38 39 def save(self):39 def _save(self): 40 40 Session.objects.create( 41 41 session_key = self.session_key, 42 42 session_data = self.encode(self._session),