New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:

Currently, an XMLRPC client communicating with a server running Python can make 
Python style calls but exceptions get collapsed into a standard FaultException 
making it difficult to program in a Pythonic style:

proxy = xmlrpc.client.ServerProxy("http://localhost:8000/";)
try:
    value = proxy.lookup('somekey')
except xmlrpc.client.Fault as err:
    if err.faultCode == 1 and 'KeyError' in err.faultString:
        k = re.search(r":.(\w+)' not found$", err.faultString).groups(1)
        raise KeyError(k)
 
It would be better if we could do this automatically (search for a pure python 
exception of the same name and raise it instead of a Fault):

proxy = xmlrpc.client.ServerProxy("http://localhost:8000/";, 
python_exceptions=True)

try:
   value = proxy.lookup('somekey')
except KeyError as e:
   ...

----------
messages: 147572
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Option for XMLRPC clients to automatically transform Fault exceptions 
into standard exceptions
type: feature request
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13397>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to