473,382 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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 3113
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Maxim Khesin | last post by:
Hi, the typical usage of SimpleXMLRPCServer registers some class with the server instance and then jumps into a serve-forever loop, e.g. server = SimpleXMLRPCServer(('', 8000))...
0
by: Thomas G. Apostolou | last post by:
Hello all, I use Python 2.3.3 and try to patch SimpleXMLRPCServer.py with the patch i got from Python.org. so after changing to the directory where both SimpleXMLRPCServer.py and...
3
by: Daniel Crespo | last post by:
Hello, Does anyone know which methods do I have to override for allowing Nones to be accepted and sended from SimpleXMLRPCServer to the client? Thanks Daniel
0
by: JDF | last post by:
I am trying to create a Windows service using SimpleXMLRPCServer and win32serviceutil. The service itself seems to be working properly (starts, stops, etc) and I can connect using an XMLRPC client...
0
by: Juju | last post by:
Hi, First, sorry for my poor English ! I used the SimpleXMLRPCServer facility of Python to develop a multithread-server, here's part of my code : -- class...
3
by: Achim Domma | last post by:
Hi, is SimpleXMLRPCServer multithreaded or how does it handle multiple clients? I want to implement a simple server which will be queried by multiple processes for work to be done. The server...
6
by: gregpinero | last post by:
I have a pretty simple XMLRPCServer, something along the lines of the example: server = SimpleXMLRPCServer(("localhost", 8000)) server.register_function(pow) server.register_function(lambda...
3
by: Sean DiZazzo | last post by:
Why is the following not working? Is there any way to get keyword arguments working with exposed XMLRPC functions? ~~~~~~~~~~~~~~~~ server.py import SocketServer from SimpleXMLRPCServer import...
4
by: mh | last post by:
My SimpleXMLRPCServer program prints to stderr a line like this for each request: ohm..pixar.com - - "POST /RPC2 HTTP/1.0" 200 - Is there a way to turn this logging off? I have RTFM and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.