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

fix send files list as list #32

Merged
merged 1 commit into from
Feb 26, 2014

Conversation

nwlunatic
Copy link
Contributor

comment for make_curl_post_files(data): says
"""Convert parameters dict, list or tuple to cURL style tuple"""
but list actually call's an error:
raise ValueError("%s argument must be list, tuple or dict, not %s" %
("make_curl_post_files", type(data)))

Also in agreed with this pull request #14:

due to this code

class Request(object):
    def __init___(self, ...):
        ...
        # String, dict, tuple, list
        if isinstance(data, (StringTypes, NoneType)):
            self._data = data
        else:
            self._data = data_wrapper(data)

def data_wrapper(data):
    """Convert data to list and returns
    """
    ...

 def build_opener(self, url, opener=None):
     ...
        if self._files is not None:
                post_params = self._files
                if isinstance(self._data, (TupleType, DictType)):
                    post_params.extend(data_wrapper(self._data))
                opener.setopt(opener.HTTPPOST, post_params)

so we will never get to post_params.extend(data_wrapper(self._data)) if we are trying to send some files, because data is going to be wrapped in list in Request constructor.

Lispython added a commit that referenced this pull request Feb 26, 2014
@Lispython Lispython merged commit 37046aa into Lispython:master Feb 26, 2014
@Lispython
Copy link
Owner

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants