Commit 67ba0ee4 authored by Ayush Tiwari's avatar Ayush Tiwari Committed by Ayush Tiwari

BusinessTemplate: Maintain consistency while adding values in modified_object_list

Making "modified_object_list" consistent by always containing lists and not
sometimes lists and sometimes tuples.
parent 5d11c3f3
......@@ -1073,7 +1073,7 @@ class ObjectTemplateItem(BaseTemplateItem):
if installed_item._objects.has_key(path):
upgrade_list.append((path, installed_item._objects[path]))
else: # new object
modified_object_list[path] = 'New', type_name
modified_object_list[path] = ['New', type_name]
# update _p_jar property of objects cleaned by removeProperties
transaction.savepoint(optimistic=True)
......@@ -1094,15 +1094,15 @@ class ObjectTemplateItem(BaseTemplateItem):
old_io.close()
if new_obj_xml != old_obj_xml:
if context.isKeepObject(path):
modified_object_list[path] = 'Modified but should be kept', type_name
modified_object_list[path] = ['Modified but should be kept', type_name]
else:
modified_object_list[path] = 'Modified', type_name
modified_object_list[path] = ['Modified', type_name]
# get removed object
for path in set(installed_item._objects) - set(self._objects):
if context.isKeepObject(path):
modified_object_list[path] = 'Removed but should be kept', type_name
modified_object_list[path] = ['Removed but should be kept', type_name]
else:
modified_object_list[path] = 'Removed', type_name
modified_object_list[path] = ['Removed', type_name]
return modified_object_list
def _backupObject(self, action, trashbin, container_path, object_id, **kw):
......
......@@ -6857,7 +6857,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
finally:
shutil.rmtree(export_dir)
self.assertEqual(
{'test_document': ('Removed but should be kept', 'Path')},
{'test_document': ['Removed but should be kept', 'Path']},
new_bt.preinstall())
def test_update_business_template_with_template_keep_path_list_catalog_method(self):
......@@ -6912,7 +6912,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
shutil.rmtree(export_dir)
self.assertEqual(
{'portal_catalog/erp5_mysql_innodb/z_fake_method':
('Removed but should be kept', 'CatalogMethod')},
['Removed but should be kept', 'CatalogMethod']},
new_bt.preinstall())
def test_BusinessTemplateWithTest(self):
......
......@@ -1155,4 +1155,4 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
# the PythonScript is recognised as modified
result = second_import_template.preinstall()
self.assertEquals(result.get('portal_skins/%s/%s' % (skin_folder_id, python_script_id)),
('Modified', 'Skin'))
['Modified', 'Skin'])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment