Returning Fault instances in xmlrpc

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Sun May 5 02:46:09 EDT 2002


In article <mailman.1020579191.22631.python-list at python.org>, Brian
Quinlan wrote:
>> But why aren't Fault objects returned when I explicitly return them
>> from my functions? Shouldn't it either be illegal to return them or
>> equivalent to raising them?
>
>Both of these Python functions are legal but they have different
>semantics:
>
>def myfunc(): raise TypeError()
>def myfunc(): return TypeError()
>
>Do you consider that a design flaw? If not, why should it be a design
>flaw with the xmlrpc library?

As I responded to Brian privately, I think returning an object of an
xmlrpc type should yield the equivalent object in the other end --
e.g. returning a Boolean object should yield a Boolean object, and
returning a Fault object should yield a Fault object -- not a mapping
(because the server converts the instance to a mapping automatically).

If xmlrpc had any notion of the difference between the two functions
above, I wouldn't mind having them behave differently, but xmlrpc
doesn't have the richness of Python function/method invocation.

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list