By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,320 Members | 2,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,320 IT Pros & Developers. It's quick & easy.

simplexmlrpcserver and allow_none

P: n/a

Hello,

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?

Thanks,

Laszlo

Jun 8 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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!
Jun 8 '06 #2

P: n/a
Thomas Bellman írta:
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

Thank you. :-)
I already copied out SimpleXMLRPCServer.py from the 2.5 trunk and it
seems to be working, but this is much sorter.

Laszlo

Jun 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.