Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected XML-RPC Method Return Types #191

Closed
vladimir-v-diaz opened this issue Feb 5, 2014 · 1 comment
Closed

Unexpected XML-RPC Method Return Types #191

vladimir-v-diaz opened this issue Feb 5, 2014 · 1 comment

Comments

@vladimir-v-diaz
Copy link

Several of the xmlrpc methods in warehouse/legacy/xmlrpc.py return tuples (e.g., release_downloads()), but what the client actually receives are lists:

>>> client = ServerProxy('https://pypi.python.org/pypi')
>>> client.release_downloads('pip', '1.5.2')
[['pip-1.5.2-py2.py3-none-any.whl', 39890], ['pip-1.5.2.tar.gz', 141630]]
>>> 

The Warehouse and Cheeseshop documentation state tuples are returned. test_xmlrpc.py test cases check for tuples and even pass, although they use pretend so fail to test for xmlrpclib side effects.

Server:

from SimpleXMLRPCServer import SimpleXMLRPCServer

def get_tuple():
  return ('foo', 'bar')

server = SimpleXMLRPCServer(('localhost', 8080))
server.register_function(get_tuple)
server.serve_forever()

Client:

$ python
Python 2.7.3 (default, Sep 26 2013, 20:08:41) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xmlrpclib import ServerProxy
>>> client = ServerProxy('http://localhost:8080')
>>> client.get_tuple()
['foo', 'bar']
>>> 

Python sequence types, corresponding to XML-RPC's arrays data type, are returned as lists by thexmlrpclib module. Should warehouse/legacy/xmlrpc.py methods return lists instead of tuples to match xmlrpclib's behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants