From 55f460eee729df89ce446eaa1cc1f2bfce7752d5 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Wed, 23 Feb 2011 16:27:29 +0100 Subject: [PATCH] Auto-detect (Forking|Threading)MixIn for HTTP services Signed-off-by: Sven Velt --- nagixsc/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nagixsc/__init__.py b/nagixsc/__init__.py index 74c11ff..a243513 100644 --- a/nagixsc/__init__.py +++ b/nagixsc/__init__.py @@ -572,7 +572,12 @@ def daemonize(pidfile=None, stdin='/dev/null', stdout='/dev/null', stderr='/dev/ ############################################################################## -class MyHTTPServer(SocketServer.ForkingMixIn, BaseHTTPServer.HTTPServer): +if 'ForkingMixIn' in SocketServer.__dict__: + MixInClass = SocketServer.ForkingMixIn +else: + MixInClass = SocketServer.ThreadingMixIn + +class MyHTTPServer(MixInClass, BaseHTTPServer.HTTPServer): def __init__(self, server_address, HandlerClass, ssl=False, sslpemfile=None): SocketServer.BaseServer.__init__(self, server_address, HandlerClass) -- 2.30.2