diff options
author | Collin Winter <collinw@gmail.com> | 2007-03-10 14:41:48 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-03-10 14:41:48 (GMT) |
commit | ae04106a0ebf271b4c4f3ce04c1ee84cab9b43fe (patch) | |
tree | 1fc1a6e52d138459fc058cff6b4ba5b13c779bda /Lib | |
parent | 3351aa7dd509c72335fd37a7eae79e62ba48f773 (diff) | |
download | cpython-ae04106a0ebf271b4c4f3ce04c1ee84cab9b43fe.zip cpython-ae04106a0ebf271b4c4f3ce04c1ee84cab9b43fe.tar.gz cpython-ae04106a0ebf271b4c4f3ce04c1ee84cab9b43fe.tar.bz2 |
Patch #1599845: Add an option to disable the implicit calls to server_bind() and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer and DocXMLRPCServer.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/DocXMLRPCServer.py | 6 | ||||
-rw-r--r-- | Lib/SimpleXMLRPCServer.py | 4 | ||||
-rw-r--r-- | Lib/SocketServer.py | 9 |
3 files changed, 11 insertions, 8 deletions
diff --git a/Lib/DocXMLRPCServer.py b/Lib/DocXMLRPCServer.py index 86ed32b..4318714 100644 --- a/Lib/DocXMLRPCServer.py +++ b/Lib/DocXMLRPCServer.py @@ -252,8 +252,10 @@ class DocXMLRPCServer( SimpleXMLRPCServer, """ def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler, - logRequests=1): - SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests) + logRequests=1, allow_none=False, encoding=None, + bind_and_activate=True): + SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests, + allow_none, encoding, bind_and_activate) XMLRPCDocGenerator.__init__(self) class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler, diff --git a/Lib/SimpleXMLRPCServer.py b/Lib/SimpleXMLRPCServer.py index 53ad9c5..8c85f80 100644 --- a/Lib/SimpleXMLRPCServer.py +++ b/Lib/SimpleXMLRPCServer.py @@ -518,11 +518,11 @@ class SimpleXMLRPCServer(SocketServer.TCPServer, allow_reuse_address = True def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, - logRequests=True, allow_none=False, encoding=None): + logRequests=True, allow_none=False, encoding=None, bind_and_activate=True): self.logRequests = logRequests SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding) - SocketServer.TCPServer.__init__(self, addr, requestHandler) + SocketServer.TCPServer.__init__(self, addr, requestHandler, bind_and_activate) # [Bug #1222790] If possible, set close-on-exec flag; if a # method spawns a subprocess, the subprocess shouldn't have diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py index 7d9b9a5..f0f471a 100644 --- a/Lib/SocketServer.py +++ b/Lib/SocketServer.py @@ -279,7 +279,7 @@ class TCPServer(BaseServer): Methods for the caller: - - __init__(server_address, RequestHandlerClass) + - __init__(server_address, RequestHandlerClass, bind_and_activate=True) - serve_forever() - handle_request() # if you don't use serve_forever() - fileno() -> int # for select() @@ -322,13 +322,14 @@ class TCPServer(BaseServer): allow_reuse_address = False - def __init__(self, server_address, RequestHandlerClass): + def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True): """Constructor. May be extended, do not override.""" BaseServer.__init__(self, server_address, RequestHandlerClass) self.socket = socket.socket(self.address_family, self.socket_type) - self.server_bind() - self.server_activate() + if bind_and_activate: + self.server_bind() + self.server_activate() def server_bind(self): """Called by constructor to bind the socket. |