Commit 8880f88d authored by Denis Bilenko's avatar Denis Bilenko

add handler_class classvariable to WSGIServer; allow overriding it in __init__

parent bae0632b
......@@ -106,7 +106,7 @@ class WSGIHandler(object):
class WSGIServer(HTTPServer):
WSGIHandler = WSGIHandler
handler_class = WSGIHandler
base_env = {'SCRIPT_NAME': '',
'GATEWAY_INTERFACE': 'CGI/1.1',
......@@ -118,6 +118,9 @@ class WSGIServer(HTTPServer):
'wsgi.run_once': False}
def __init__(self, socket_or_address, application, **kwargs):
handler_class = kwargs.pop('handler_class', None)
if handler_class is not None:
self.handler_class = handler_class
HTTPServer.__init__(self, **kwargs)
self.address = socket_or_address
self.application = application
......@@ -142,7 +145,7 @@ class WSGIServer(HTTPServer):
return sock
def handle(self, req):
handler = self.WSGIHandler(req)
handler = self.handler_class(req)
handler.handle(self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment