diff roundup/scripts/roundup_server.py @ 2230:ca2664e095be

disable forking server when os.fork() not available [SF#938586]
author Richard Jones <richard@users.sourceforge.net>
date Tue, 20 Apr 2004 21:57:29 +0000
parents 25b95aa44d60
children 3cdefcb2b7d2 c77483d2cda4
line wrap: on
line diff
--- a/roundup/scripts/roundup_server.py	Tue Apr 20 21:55:45 2004 +0000
+++ b/roundup/scripts/roundup_server.py	Tue Apr 20 21:57:29 2004 +0000
@@ -17,7 +17,7 @@
 
 """Command-line script that runs a server over roundup.cgi.client.
 
-$Id: roundup_server.py,v 1.45 2004-04-09 01:31:16 richard Exp $
+$Id: roundup_server.py,v 1.46 2004-04-20 21:57:16 richard Exp $
 """
 __docformat__ = 'restructuredtext'
 
@@ -238,11 +238,19 @@
     exc_type, exc_value = sys.exc_info()[:2]
     return _('Error: %s: %s' % (exc_type, exc_value))
 
+# See whether we can use the forking server
+if hasattr(os, 'fork'):
+    class server_class(SocketServer.ForkingMixIn, BaseHTTPServer.HTTPServer):
+        pass
+else:
+    server_class = BaseHTTPServer.HTTPServer
+
 try:
     import win32serviceutil
 except:
     RoundupService = None
 else:
+
     # allow the win32
     import win32service
     import win32event
@@ -460,12 +468,9 @@
         # obtain server before changing user id - allows to use port <
         # 1024 if started as root
         address = (hostname, port)
-        server_klass = BaseHTTPServer.HTTPServer
-        class server_klass(SocketServer.ForkingMixIn,
-                BaseHTTPServer.HTTPServer):
-            pass
+
         try:
-            httpd = server_klass(address, RoundupRequestHandler)
+            httpd = server_class(address, RoundupRequestHandler)
         except socket.error, e:
             if e[0] == errno.EADDRINUSE:
                 raise socket.error, \

Roundup Issue Tracker: http://roundup-tracker.org/