Skip to content

Commit

Permalink
[IMP] prestapyt: Adapt to new prestashop versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-teruel committed Jun 7, 2016
1 parent 5248b93 commit 14576a5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions prestapyt/prestapyt.py
Expand Up @@ -278,8 +278,8 @@ def add_with_url(self, url, xml=None, files=None):
headers, body = self.encode_multipart_formdata(files)
return self._parse(self._execute(url, 'POST', body=body, add_headers=headers)[2])
elif xml is not None:
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
return self._parse(self._execute(url, 'POST', body=urllib.urlencode({'xml': xml}), add_headers=headers)[2])
headers = {'Content-Type': 'text/xml'}
return self._parse(self._execute(url, 'POST', body=xml, add_headers=headers)[2])
else:
raise PrestaShopWebServiceError('Undefined data.')

Expand Down Expand Up @@ -370,8 +370,8 @@ def edit_with_url(self, url, content):
@param content: modified XML as string of the resource.
@return: an ElementTree of the Webservice's response
"""
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
return self._parse(self._execute(url, 'PUT', body=unicode_encode.encode(content), add_headers=headers)[2])
headers = {'Content-Type': 'text/xml'}
return self._parse(self._execute(url, 'PUT', body=content, add_headers=headers)[2])

def delete(self, resource, resource_ids):
"""
Expand Down

0 comments on commit 14576a5

Please sign in to comment.