XML-RPC and None objects

Fredrik Lundh effbot at telia.com
Wed Apr 12 11:00:00 EDT 2000


Peter Funk wrote:
> I stumbled into the same problem and since I currently use XML-RPC only
> between my own server and clients I decided to ignore the official
> specification and added a 'None'-handler to my version of Fredrik Lundhs
> library.  The needed patch is indeed very very simple:  Add the following
> lines to the class 'Marshaller' in 'xmlrpclib.py' you are done:
>
>     def dump_None(self, none):
>         self.write("<value><null></null></value>\n")
>     dispatch[NoneType] = dump_None
>
> Since the class 'Unmarshaller' already returns 'None' for all unknown
values
> a modification there is not required.  This works fine for me.  YMMV.

footnote: if you change "null" to "nil", you'll be compatible
with several other XML-RPC implementations.

(iirc, the current xmlrpclib codebase has a flag to enable "nil"
encoding support.  it also fixes the accidental "return None
for unknown values" feature...).

otoh, you will soon be able to use "soaplib.py" instead of
"xmlrpclib.py", but that's another story.

</F>





More information about the Python-list mailing list