Commits

Jun Omae committed 4073db1

0.13dev: Saves the session when catching `RequestDone` instead of `req.redirect()`.

Closes #9453.

  • Participants
  • Parent commits 6747a7a
  • Branches trunk

Comments (0)

Files changed (2)

         for listener in self.redirect_listeners:
             listener(self, url, permanent)
         
-        self.session.save() # has to be done before the redirect is sent
-
         if permanent:
             status = 301 # 'Moved Permanently'
         elif self.method == 'POST':
 
                     output = chrome.render_template(req, template, data,
                                                     content_type)
-                    # Give the session a chance to persist changes
-                    req.session.save()
                     req.send(output, content_type or 'text/html')
                 else:
                     self._post_process_request(req)
             except RequestDone:
+                # Give the session a chance to persist changes after a send()
+                req.session.save()
                 raise
             except:
                 # post-process the request in case of errors