Gabriel Genellina wrote:
Yes, it does!
I was totally on the wrong track. Of course the ThreadingMixin can also
be "mixed in" later in the chain.
-- Gerhard
En Tue, 26 Aug 2008 03:20:53 -0300, Gerhard Häring <gh@ghaering.de >
escribi�:
>
>
I'm not sure I understand completely the question - does the code below
work for you?
>
class MyWSGIServer(Th readingMixIn, wsgiref.simple_ server.WSGIServ er):
pass
escribi�:
>
>In a recent experiment I've done this:
>>
>from BaseHTTPServer import HTTPServer, BaseHTTPRequest Handler
>from wsgiref.simple_ server import make_server, demo_app
>from SocketServer import ThreadingMixIn
>>
># Let's make a WSGI server that can use multiple threads.
>>
>class ThreadedHTTPSer ver(ThreadingMi xIn, HTTPServer):
> """Handle requests in a separate thread."""
>>
># Evil! ;-)
>from wsgiref.simple_ server import WSGIServer as MyWSGIServer
>MyWSGIServer._ _bases__ = (ThreadedHTTPSe rver,)
>>
>Now I wonder if there's a less evil way that does not involve copy &
>paste of the WSGIServer code (only couple of lines, but I hate
>duplication) ?!
>>
>from BaseHTTPServer import HTTPServer, BaseHTTPRequest Handler
>from wsgiref.simple_ server import make_server, demo_app
>from SocketServer import ThreadingMixIn
>>
># Let's make a WSGI server that can use multiple threads.
>>
>class ThreadedHTTPSer ver(ThreadingMi xIn, HTTPServer):
> """Handle requests in a separate thread."""
>>
># Evil! ;-)
>from wsgiref.simple_ server import WSGIServer as MyWSGIServer
>MyWSGIServer._ _bases__ = (ThreadedHTTPSe rver,)
>>
>Now I wonder if there's a less evil way that does not involve copy &
>paste of the WSGIServer code (only couple of lines, but I hate
>duplication) ?!
I'm not sure I understand completely the question - does the code below
work for you?
>
class MyWSGIServer(Th readingMixIn, wsgiref.simple_ server.WSGIServ er):
pass
I was totally on the wrong track. Of course the ThreadingMixin can also
be "mixed in" later in the chain.
-- Gerhard