[z3-checkins] r51115 - z3/deliverance/DeliveranceVHoster/trunk/dvhoster
ejucovy at codespeak.net
ejucovy at codespeak.net
Tue Jan 29 18:28:14 CET 2008
Author: ejucovy
Date: Tue Jan 29 18:28:04 2008
New Revision: 51115
Added:
z3/deliverance/DeliveranceVHoster/trunk/dvhoster/socket_error.py
Modified:
z3/deliverance/DeliveranceVHoster/trunk/dvhoster/dispatcher.py
Log:
convert socket errors to http server errors
Modified: z3/deliverance/DeliveranceVHoster/trunk/dvhoster/dispatcher.py
==============================================================================
--- z3/deliverance/DeliveranceVHoster/trunk/dvhoster/dispatcher.py (original)
+++ z3/deliverance/DeliveranceVHoster/trunk/dvhoster/dispatcher.py Tue Jan 29 18:28:04 2008
@@ -9,6 +9,7 @@
from wsgifilter import proxyapp
from wsgifilter import relocateresponse
from deliverance.wsgimiddleware import DeliveranceMiddleware
+from dvhoster.socket_error import SocketErrorToHTTPServerException
from dvhoster.model import DomainInfoSet, DomainInfoApp
from dvhoster import current_environ
from dvhoster.debuginterp import Renderer
@@ -180,7 +181,8 @@
tasklist=self.transcluder_pool,
include_predicate=self.transcluder_ok_hosts,
recursion_predicate=self.transcluder_ok_hosts)
-
+ app = SocketErrorToHTTPServerException(app)
+
if should_theme_uri:
if self.rewrite_links:
app = relocateresponse.RelocateMiddleware(
@@ -215,7 +217,7 @@
renderer=Renderer,
is_internal_uri=is_internal_uri)
return app(environ, start_response)
-
+
def find_static_file(self, domain_info, path_info):
"""
If the request matches a static file, returns a WSGI
Added: z3/deliverance/DeliveranceVHoster/trunk/dvhoster/socket_error.py
==============================================================================
--- (empty file)
+++ z3/deliverance/DeliveranceVHoster/trunk/dvhoster/socket_error.py Tue Jan 29 18:28:04 2008
@@ -0,0 +1,12 @@
+import socket
+from paste.httpexceptions import HTTPGatewayTimeout
+
+class SocketErrorToHTTPServerException(object):
+ def __init__(self, app):
+ self.app = app
+
+ def __call__(self, environ, start_response):
+ try:
+ return self.app(environ, start_response)
+ except socket.error:
+ raise HTTPGatewayTimeout
More information about the z3-checkins
mailing list