type(xmlrpclib.Fault.faultCode)...

Brian Quinlan brian at sweetapp.com
Fri May 10 12:41:25 EDT 2002


> -----Original Message-----
> From: python-list-admin at python.org
[mailto:python-list-admin at python.org]
> On Behalf Of Magnus Lie Hetland
> Sent: Friday, May 10, 2002 8:22 AM
> To: python-list at python.org
> Subject: Re: type(xmlrpclib.Fault.faultCode)...
> 
> In article <slrnadnji4.dl0.mlh at vier.idi.ntnu.no>, Magnus Lie Hetland
> wrote:
> >
> 
> I found the problem myself... I looked in SimpleXMLRPCServer, and it
> turns out that it turns every exception x into a Fault with faultCode
> 1 (an int, not a string, as the xmlrpclib docs say... 

The XML-RPC specification says:

The <methodResponse> could also contain a <fault> which contains a
<value> which is a <struct> containing two elements, one named
<faultCode>, an <int> and one named <faultString>, a <string>.

So I would say that there is a documentation (and perhaps
implementation) bug for xmlrpclib.

> Not sure what
> the deal is here) and faultCode str(x). When I raise Fault objects of
> my own, this gives a the highly undesirable behaviour of constructing
> a _new_ Fault object which ignores my faultCode and which ends up with
> a pretty odd faultString.
>
> If I can neither return Faults as Faults nor raise custom Faults -- is
> there any way one can use custom Faults with SimpleXMLRPCServer?
> 
> If not, is there any interest in a patch that would allow this? Are
> there any suggested workarounds? Am I missing something?

Yeah, I suck. I've already submitted patches to clean my mess though.
You might want to use the SimpleXMLRPCServer.py found here:
http://www.sweetapp.com/xmlrpc/

It is the integration of all the proposed 2.3 patches.

Cheers,
Brian






More information about the Python-list mailing list