Merge lp:~camptocamp/openerp-connector-magento/7.0-image-1258418-gbr into lp:~openerp-connector-core-editors/openerp-connector-magento/7.0

Proposed by Guewen Baconnier @ Camptocamp on 2013-12-18
Status: Merged
Approved by: Guewen Baconnier @ Camptocamp on 2014-01-14
Approved revision: 936
Merged at revision: 940
Proposed branch: lp:~camptocamp/openerp-connector-magento/7.0-image-1258418-gbr
Merge into: lp:~openerp-connector-core-editors/openerp-connector-magento/7.0
Diff against target: 39 lines (+4/-4)
2 files modified
magentoerpconnect/product.py (+3/-3)
magentoerpconnect/tests/test_import_product_image.py (+1/-1)
To merge this branch: bzr merge lp:~camptocamp/openerp-connector-magento/7.0-image-1258418-gbr
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no tests 2013-12-18 Approve on 2014-01-14
Review via email: mp+199537@code.launchpad.net

Commit message

[FIX] the main image has the 'image' type, not 'base'

Description of the change

To post a comment you must log in.
Stefaan Ferket (s-ferket) wrote :

This one works perfect for us. It now takes the image that we expected.

LGTM

review: Approve (code review, no tests)

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 2013-11-09 23:01:40 +0000
3+++ magentoerpconnect/product.py 2013-12-18 19:33:00 +0000
4@@ -259,7 +259,7 @@
5
6 def _sort_images(self, images):
7 """ Returns a list of images sorted by their priority.
8- An image with the 'base' type is the the primary one.
9+ An image with the 'image' type is the the primary one.
10 The other images are sorted by their position.
11
12 The returned list is reversed, the items at the end
13@@ -267,11 +267,11 @@
14 """
15 if not images:
16 return {}
17- # place the images where the type is 'base' first then
18+ # place the images where the type is 'image' first then
19 # sort them by the reverse priority (last item of the list has
20 # the the higher priority)
21 def priority(image):
22- primary = 'base' in image['types']
23+ primary = 'image' in image['types']
24 try:
25 position = int(image['position'])
26 except ValueError:
27
28=== modified file 'magentoerpconnect/tests/test_import_product_image.py'
29--- magentoerpconnect/tests/test_import_product_image.py 2013-09-03 09:55:45 +0000
30+++ magentoerpconnect/tests/test_import_product_image.py 2013-12-18 19:33:00 +0000
31@@ -70,7 +70,7 @@
32 """ Check if the images are sorted in the correct priority """
33 env = mock.Mock()
34 importer = CatalogImageImporter(env)
35- file1 = {'file': 'file1', 'types': ['base'], 'position': '10'}
36+ file1 = {'file': 'file1', 'types': ['image'], 'position': '10'}
37 file2 = {'file': 'file2', 'types': ['thumbnail'], 'position': '3'}
38 file3 = {'file': 'file3', 'types': ['thumbnail'], 'position': '4'}
39 file4 = {'file': 'file4', 'types': [], 'position': '10'}