This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients
Date 2005-12-06.04:14:58
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The XML-RPC spec supports a fairly limited set of datatypes.
Most languages, Python included, contain many more types
than XML-RPC.  Some types, such as Python's complex number
type, have no reasonable analog in XML-RPC.  Others, such as
unicode objects and array objects do.  This patch allows
anything that can be converted to a list but that is not
otherwise supported directly by the xmlrpclib module already
to be marshalled as an XML-RPC array if the allow_iter
parameter to the ServerProxy constructor evaluated to true.
This includes sets and arrays.

Motivation...

1. Python already overloads the XML-RPC array type with both
   lists and tuples.  This just extends that overloading to
   other currently unsupported Python types which can be
   converted to lists.  Why should lists and tuples have all the
   fun?

2. Providing transparent conversion to XML-RPC arrays keeps
   calling code a bit cleaner.  One of the attractions of
   XML-RPC is that the remote procedure call looks identical
   to a local call.  This is especially true in Python
   because of /F's excellent little _Method class.  Clearly
   as a programmer I could type:

       import array
       a = array.array('i', [1, 2,3])
       ...
       from somemodule import somefunction
       print somefunction(list(a))

   but that reveals details of the implementation of
   somefunction, namely that it can't handle arrays
   directly, even though in most respects arrays
   and lists are interchangeable.

Attached is a patch for the xmlrpclib library that
implements this feature, including minor doc changes and a
new test case.
History
Date User Action Args
2007-08-23 15:44:53adminlinkissue1374063 messages
2007-08-23 15:44:53admincreate