Ticket #3881: session_save.patch
File session_save.patch, 1.1 KB (added by , 18 years ago) |
---|
-
contrib/sessions/middleware.py
12 12 self.session_key = session_key 13 13 self.accessed = False 14 14 self.modified = False 15 self.exception_occured = False 15 16 16 17 def __contains__(self, key): 17 18 return key in self._session … … 71 72 def process_request(self, request): 72 73 request.session = SessionWrapper(request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)) 73 74 75 def process_exception(self, request, exception): 76 self.exception_occured = True; 77 74 78 def process_response(self, request, response): 79 # Don't try to save session when process method raised an exception. In case of database exceptions 80 # it may not even be possible. See ticket #3881. 81 if self.exception_occured: 82 return response 83 75 84 # If request.session was modified, or if response.session was set, save 76 85 # those changes and set a session cookie. 77 86 try: