Laszlo Nagy <ga*****@designaproduct.biz> wrote:
I ran in the same problem again. Many others have the same problem. Just
Google for this: "SimpleXMLRPCServer allow_none site:python.org".
Looks like the 'allow_none' patch was commited to trunk on 2005 Dec (
http://mail.python.org/pipermail/pyt...er/048289.html )
I just upgraded to Python 2.4.3 (it was released on March 29, 2006) and
SimpleXMLRPCServer.py still has the old code.
I can work around this by coping the whole file into a new file and
patch it, but I hate to do that.
I wonder why it has not been commited to the standard library yet. Does
anyone know if it will be in the next bugfix release?
Fredrik has already answered your specific question, but while
waiting for 2.5, another way to work around it is to do:
import xmlrpclib
# WARNING: Dirty hack below.
# Replace the dumps() function in xmlrpclib with one that by default
# handles None, so SimpleXMLRPCServer can return None.
class _xmldumps(object):
def __init__(self, dumps):
self.__dumps = (dumps,)
def __call__(self, *args, **kwargs):
kwargs.setdefault('allow_none', 1)
return self.__dumps[0](*args, **kwargs)
xmlrpclib.dumps = _xmldumps(xmlrpclib.dumps)
import SimpleXMLRPCServer
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
"This isn't right. This isn't even wrong." ! bellman @ lysator.liu.se
-- Wolfgang Pauli ! Make Love -- Nicht Wahr!