- summary: Major patch with faults & Introspection --> Major patch with faults & Introspection
- status: open --> closed-accepted
I wrote a major patch which support xmlrpc faults and
Introspection
<http://xmlrpc.usefulinc.com/doc/reserved.html>. It
includes my previous patch for pipe support.
The xmlrpc fault is handled by a xmlrpc.fault class.
You can raise exceptions in server xmlrpc methods like
that:
def getFault(srv, src, uri, mth, parm):
raise xmlrpc.fault, (666, 'Something got wrong!')
The server response is xmlrpc fault with faultCode
'666' and faultString 'Something got wrong!'
On the other side, the client will receive xmlrpc
faults as xmlrpc.fault objects you can catch like:
try:
print client.execute('getFault', [])
except xmlrpc.fault, f:
print 'xmlrpc.fault: ', f
if f.faultCode == 666:
print 'This is a good result!'
except xmlrpc.error, e:
print 'xmlrpc.error: ', e
I changed the library default faultCode to -1 rather
than 1 to avoid conflict with errno.
The class xmlrpc.error is for library internal errors.
There is some bugs corrected: setOnErr now accept None
as parameter, xml comments are correcly chomped.
The patch is big so i leave the new sources at
<http://homepage.mac.com/jeancharlesbertin/py-xmlrpc-0.8.7-jc.tar.gz>
Please send comments at <mailto:jc.bertin@mipsys.com>