473,387 Members | 1,535 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,387 software developers and data experts.

allow_none=True in SimpleXMLRPCServer

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

Dec 12 '05 #1
3 2392
Hi, I faced the same same situation, and my quick problem solving was
copying SimpleXMLRPCServer.py to current directory, and "patch" this line:

response = xmlrpclib.dumps(response, methodresponse=1)

into

response = xmlrpclib.dumps(response, methodresponse=1, allow_none=True)
Another better approach is to subclass SimpleXMLRPCDispatcher, and
override just the method that contains above line (copy paste whole
function + fix the parameter), then copy paste the whole class
definition of SimpleXMLRPCServer, but change the mixin to your new
subclass, then give it a new name ie MySimpleXMLRPCServer. Too much
hassle I guess.

Another alternative might be subclassing Marshall class in xmlrpclib.py
override the __init__ as so self.allow_none always True, then set
xmlrpclib.Marshall = yournewsubclass. Ie:

#yourserver.py
import xmlrpclib
class MyMarshall(xmlrpclib.Marshall):
def __init__(self, encoding=None, allow_none=0):
self.memo = {}
self.data = None
self.encoding = encoding
self.allow_none = 1
xmlrpclib.Marshall = MyMarshall

#...might work...

Daniel Crespo wrote:
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

Dec 14 '05 #2
Thank you very much! I will try it as soon as possible, and write you
back with my results.

Best regards

Daniel

Dec 14 '05 #3
Hi Dody!

It works perfect! Now, I want the SimpleXMLRPCServer.py not to be on
the same directory, but in my /lib directory. I tried it, but it seems
that the module loads from python24/ first. How can I change this?

Thank you!

Dec 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Laszlo Nagy | last post by:
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...
0
by: Laszlo Nagy | last post by:
I'm running a service on a machine. The service is written in Python (of course) and it connects to an XMLRPC server periodically. It recreates the ServerProxy instance each time it needs to...
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...
0
by: Laszlo Nagy | last post by:
Hi, I would like to have a strage XML RPC server. It should use one main thread for all connections. I have some code like this (using a custom RPC server class): server_address =...
1
by: martin f krafft | last post by:
Hi, xmlrpclib.dumps((None,), allow_none=True) yields '<params>\n<param>\n<value><nil/></value></param>\n</params>\n' Why doesn't it just yield ...
13
by: Andrew | last post by:
Hi I was wondering if there is anyway with XML RPC to send a string of text from the server to the client with out calling return thus breaking my loop for example def somefunc(): for...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.