469,568 Members | 1,350 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,568 developers. It's quick & easy.

simplexmlrpcserver and allow_none


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
2 2970
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
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.

Similar topics

3 posts views Thread by Maxim Khesin | last post: by
reply views Thread by Thomas G. Apostolou | last post: by
3 posts views Thread by Daniel Crespo | last post: by
reply views Thread by Juju | last post: by
3 posts views Thread by Achim Domma | last post: by
6 posts views Thread by gregpinero | last post: by
3 posts views Thread by Sean DiZazzo | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.