|
[Webware-checkins] r7118 - Webware/trunk/WebKit
From: <updates@we...> - 2007-12-08 12:56
|
Author: chrisz Date: Sat Dec 8 05:56:00 2007 New Revision: 7118 Modified: Webware/trunk/WebKit/Application.py Webware/trunk/WebKit/HTTPExceptions.py Webware/trunk/WebKit/ThreadedAppServer.py Log: Made ThreadAbortedError an HTTPException. Modified: Webware/trunk/WebKit/Application.py ============================================================================== --- Webware/trunk/WebKit/Application.py (original) +++ Webware/trunk/WebKit/Application.py Sat Dec 8 05:56:00 2007 @@ -659,10 +659,14 @@ isHTTPException = isinstance(err, HTTPException) if isHTTPException: err.setTransaction(trans) - # Get custom error page corresponding to the exception, - # but do not use custom page if response is already committed: - if not self._errorPage or trans.response().isCommitted(): + if trans.response().isCommitted(): + # response already committed, cannot display error + isHTTPException = False break + if not self._errorPage: + # no custom error page configured + break + # get custom error page for this exception url = self.errorPage(err.__class__) if isHTTPException and not url: # get custom error page for status code Modified: Webware/trunk/WebKit/HTTPExceptions.py ============================================================================== --- Webware/trunk/WebKit/HTTPExceptions.py (original) +++ Webware/trunk/WebKit/HTTPExceptions.py Sat Dec 8 05:56:00 2007 @@ -354,6 +354,18 @@ _description = "The method given is not yet implemented by this application" +class HTTPServiceUnavailable(HTTPException): + """HTTPExcecption "service unavailable" subclass. + + The server is currently unable to handle the request due to a temporary + overloading or maintenance of the server. The implication is that this + is a temporary condition which will be alleviated after some delay. + + """ + _code = 503, "Service Unavailable" + _description = "The server is currently unable to handle the request" + + class HTTPInsufficientStorage(HTTPException): """HTTPExcecption "insufficient storage" subclass. Modified: Webware/trunk/WebKit/ThreadedAppServer.py ============================================================================== --- Webware/trunk/WebKit/ThreadedAppServer.py (original) +++ Webware/trunk/WebKit/ThreadedAppServer.py Sat Dec 8 05:56:00 2007 @@ -44,6 +44,7 @@ from PidFile import ProcessRunning from AutoReloadingAppServer import AutoReloadingAppServer as AppServer from ASStreamOut import ASStreamOut, ConnectionAbortedError +from HTTPExceptions import HTTPServiceUnavailable from WebUtils.Funcs import requestURI debug = False @@ -84,7 +85,7 @@ class ProtocolError(Exception): pass -class ThreadAbortedError(Exception): +class ThreadAbortedError(HTTPServiceUnavailable): pass class RequestAbortedError(ThreadAbortedError): @@ -652,6 +653,7 @@ except ThreadAbortedError: print "Worker thread has been aborted" except Exception: + print "Exception in worker thread" traceback.print_exc(file=sys.stderr) del self._threadHandler[t] t._processing = False |
| Thread | Author | Date |
|---|---|---|
| [Webware-checkins] r7118 - Webware/trunk/WebKit | <updates@we...> |