XML-RPC and None objects

Paul Gresham gresham at mediavisual.com
Wed Apr 12 10:42:01 EDT 2000


Excuse my ignorance Peter, but is this the package I should look at if I
want
to serve a Wap application?
Regards

"Peter Funk" <pf at artcom-gmbh.de> wrote in message
news:m12fNMH-000CnCC at artcom0.artcom-gmbh.de...
> Hi!
>
> XML-RPC <http://www.xmlrpc.com> is a very nice vehicle to build
> distributed server/client systems.  Fredrik Lundhs xmlrpc package
> available at <ttp://www.pythonware.com/products/xmlrpc/> provides
> everything you need to build clients and servers in Python.
>
> But the current XML-RPC specification has a serious problem, which
> was pointed out over a year ago by Skip Montanaro in the XML-RPC
> discussion forum:
>
> > Some time ago the subject of supporting discriminated null data in
> > XML-RPC was brought up and apparently dropped. I just checked the
> > spec and didn't see anything new. I scanned back through a couple
> > pages of topics but didn't see anything there either.
>
> > I'm busy using XML-RPC to communicate between front-end Python
> > and Perl stuff (CGI scripts, modules published through
> > ZopeHTTPServer or Mason components) and back-end Python stuff
> > (databases). The biggest problem I've encountered when converting
> > existing code to use XML-RPC is identifying and converting cases
> > where I use Python's None object. I have to figure out how it's used in
> > the caller and callee, then figure out a reasonable replacement. The end
> > result is usually that my code isn't as clear as it used to be and that
I
> > wind up adding the occasional extra bug to my code (as if I don't have
> > enough bugs to squash already).
>
> > <whine> I would *really* like to see a <nil></nil> or <nil/> data type
> > added to XML-RPC. </whine>
>
> 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.
>
> Regards, Peter
> --
> Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49
4222950260
> office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen)
>





More information about the Python-list mailing list