[Python-checkins] commit of r41589 - in python/trunk: Doc/lib/libsimplexmlrpc.tex Lib/SimpleXMLRPCServer.py Misc/NEWS

andrew.kuchling python-checkins at python.org
Sun Dec 4 17:34:48 CET 2005


Author: andrew.kuchling
Date: Sun Dec  4 17:34:40 2005
New Revision: 41589

Modified:
   python/trunk/Doc/lib/libsimplexmlrpc.tex
   python/trunk/Lib/SimpleXMLRPCServer.py
   python/trunk/Misc/NEWS
Log:
[Patch #893642] Add optional allow_none argument to SimpleXMLRPCServer, CGIXMLRPCRequestHandler

Modified: python/trunk/Doc/lib/libsimplexmlrpc.tex
==============================================================================
--- python/trunk/Doc/lib/libsimplexmlrpc.tex	(original)
+++ python/trunk/Doc/lib/libsimplexmlrpc.tex	Sun Dec  4 17:34:40 2005
@@ -13,7 +13,8 @@
 CGI environment, using \class{CGIXMLRPCRequestHandler}.
 
 \begin{classdesc}{SimpleXMLRPCServer}{addr\optional{,
-                                      requestHandler\optional{, logRequests}}}
+                                      requestHandler\optional{,
+					logRequests\optional{allow_none}}}}
 
   Create a new server instance.  The \var{requestHandler} parameter
   should be a factory for request handler instances; it defaults to
@@ -24,11 +25,13 @@
   setting this parameter to false will turn off logging.  This class
   provides methods for registration of functions that can be called by
   the XML-RPC protocol.
+  \versionchanged[The \var{allow_none} parameter was added]{2.5}
 \end{classdesc}
 
-\begin{classdesc}{CGIXMLRPCRequestHandler}{}
+\begin{classdesc}{CGIXMLRPCRequestHandler}{\optional{allow_none}}
   Create a new instance to handle XML-RPC requests in a CGI
   environment. \versionadded{2.3}
+  \versionchanged[The \var{allow_none} parameter was added]{2.5}
 \end{classdesc}
 
 \begin{classdesc}{SimpleXMLRPCRequestHandler}{}

Modified: python/trunk/Lib/SimpleXMLRPCServer.py
==============================================================================
--- python/trunk/Lib/SimpleXMLRPCServer.py	(original)
+++ python/trunk/Lib/SimpleXMLRPCServer.py	Sun Dec  4 17:34:40 2005
@@ -159,9 +159,10 @@
     reason to instantiate this class directly.
     """
 
-    def __init__(self):
+    def __init__(self, allow_none):
         self.funcs = {}
         self.instance = None
+        self.allow_none = allow_none
 
     def register_instance(self, instance, allow_dotted_names=False):
         """Registers an instance to respond to XML-RPC requests.
@@ -251,7 +252,8 @@
                 response = self._dispatch(method, params)
             # wrap response in a singleton tuple
             response = (response,)
-            response = xmlrpclib.dumps(response, methodresponse=1)
+            response = xmlrpclib.dumps(response, methodresponse=1, 
+                                       allow_none = self.allow_none)
         except Fault, fault:
             response = xmlrpclib.dumps(fault)
         except:
@@ -479,10 +481,10 @@
     allow_reuse_address = True
 
     def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler,
-                 logRequests=1):
+                 logRequests=1, allow_none=False):
         self.logRequests = logRequests
 
-        SimpleXMLRPCDispatcher.__init__(self)
+        SimpleXMLRPCDispatcher.__init__(self, allow_none)
         SocketServer.TCPServer.__init__(self, addr, requestHandler)
 
         # [Bug #1222790] If possible, set close-on-exec flag; if a 
@@ -496,8 +498,8 @@
 class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
     """Simple handler for XML-RPC data passed through CGI."""
 
-    def __init__(self):
-        SimpleXMLRPCDispatcher.__init__(self)
+    def __init__(self, allow_none=False):
+        SimpleXMLRPCDispatcher.__init__(self, allow_none)
 
     def handle_xmlrpc(self, request_text):
         """Handle a single XML-RPC request"""

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Dec  4 17:34:40 2005
@@ -454,6 +454,9 @@
 - Bug #792570: SimpleXMLRPCServer had problems if the request grew too large.
   Fixed by reading the HTTP body in chunks instead of one big socket.read().
 
+- Patch #893642: add allow_none argument to constructors of 
+  SimpleXMLRPCServer and CGIXMLRPCRequestHandler.
+
 - Bug #1110478: Revert os.environ.update to do putenv again.
 
 - Bug #1103844: fix distutils.install.dump_dirs() with negated options.


More information about the Python-checkins mailing list