Commits

Remi Delon  committed ef5e9c4

Allow programs to quit and return an error code; Small fix in sessionauthenticatefilter

  • Participants
  • Parent commits f53b5dc

Comments (0)

Files changed (2)

File cherrypy/_cpserver.py

         def _start_http():
             try:
                 self.httpserver.start()
-            except (KeyboardInterrupt, SystemExit), exc:
+            except KeyboardInterrupt, exc:
                 self.interrupt = exc
                 self.stop()
+            except SystemExit, exc:
+                self.interrupt = exc
+                self.stop()
+                raise
         threading.Thread(target=_start_http).start()
         
         if blocking:

File cherrypy/filters/sessionauthenticatefilter.py

         if cherrypy.request.path.endswith('login_screen'):
             return
         elif cherrypy.request.path.endswith('do_logout'):
-            login = cherrypy.session[session_key]
+            login = cherrypy.session.get('session_key')
             cherrypy.session[session_key] = None
             cherrypy.request.user = None
             cherrypy.thread_data.user = None
-            if on_logout:
+            if login and on_logout:
                 on_logout(login)
             from_page = cherrypy.request.params.get('from_page', '..')
             raise cherrypy.HTTPRedirect(from_page)