Merge lp:~jan-philipp-fischer/openerp-connector-magento/7.0-image-url-encode into lp:~openerp-connector-core-editors/openerp-connector-magento/7.0

Proposed by Jan-Philipp Fischer
Status: Merged
Approved by: Guewen Baconnier @ Camptocamp
Approved revision: 964
Merge reported by: Guewen Baconnier @ Camptocamp
Merged at revision: not available
Proposed branch: lp:~jan-philipp-fischer/openerp-connector-magento/7.0-image-url-encode
Merge into: lp:~openerp-connector-core-editors/openerp-connector-magento/7.0
Diff against target: 12 lines (+1/-1)
1 file modified
magentoerpconnect/product.py (+1/-1)
To merge this branch: bzr merge lp:~jan-philipp-fischer/openerp-connector-magento/7.0-image-url-encode
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review Approve
Review via email: mp+211715@code.launchpad.net

Description of the change

If a Image URL has a special character like 'é' or 'ä' the import of product fails with "UnicodeEncodeError".

With encode('utf8') the link is readable for the urllib.

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Thanks!

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magentoerpconnect/product.py'
2--- magentoerpconnect/product.py 2014-01-14 10:41:05 +0000
3+++ magentoerpconnect/product.py 2014-03-19 12:45:37 +0000
4@@ -280,7 +280,7 @@
5 return sorted(images, key=priority)
6
7 def _get_binary_image(self, image_data):
8- url = image_data['url']
9+ url = image_data['url'].encode('utf8')
10 try:
11 binary = urllib2.urlopen(url)
12 except urllib2.HTTPError as err: