Commit 591853b3 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_upgrader: applies naming convention in the script CategoryTool_checkCategoryNameConsistency

parent f19b3a4b
...@@ -70,29 +70,29 @@ if not upgrade_list:\n ...@@ -70,29 +70,29 @@ if not upgrade_list:\n
\n \n
for old_category_name, new_category_name in upgrade_list:\n for old_category_name, new_category_name in upgrade_list:\n
\n \n
sensitive_portal_types = []\n sensitive_portal_type_list = []\n
\n \n
# We gather portal types having the new category defined as a property\n # We gather portal types having the new category defined as a property\n
for portal_type in portal.portal_types.listTypeInfo():\n for portal_type in portal.portal_types.listTypeInfo():\n
if new_category_name in portal_type.getInstancePropertyAndBaseCategoryList():\n if new_category_name in portal_type.getInstancePropertyAndBaseCategoryList():\n
sensitive_portal_types.append(portal_type.getId())\n sensitive_portal_type_list.append(portal_type.getId())\n
\n \n
# if sensitive_portal_types is empty, we don\'t want to check all objects\n # if sensitive_portal_type_list is empty, we don\'t want to check all objects\n
if fixit and sensitive_portal_types:\n if fixit and sensitive_portal_type_list:\n
updateRelatedCategory = portal.portal_categories.updateRelatedCategory\n updateRelatedCategory = portal.portal_categories.updateRelatedCategory\n
\n \n
# We list objects defined by the sensitive portal types\n # We list objects defined by the sensitive portal types\n
for obj in portal.portal_catalog(portal_type=sensitive_portal_types):\n for obj in portal.portal_catalog(portal_type=sensitive_portal_type_list):\n
obj = obj.getObject()\n obj = obj.getObject()\n
new_categories_list = []\n new_category_list = []\n
obj_categories_list = obj.getCategoriesList()\n object_category_list = obj.getCategoriesList()\n
for category in obj_categories_list:\n for category in object_category_list:\n
new_category = updateRelatedCategory(category, old_category_name, new_category_name)\n new_category = updateRelatedCategory(category, old_category_name, new_category_name)\n
new_categories_list.append(new_category)\n new_category_list.append(new_category)\n
if new_categories_list != obj_categories_list:\n if new_category_list != object_category_list:\n
obj.setCategoriesList(new_categories_list)\n obj.setCategoriesList(new_category_list)\n
\n \n
for portal_type in sensitive_portal_types:\n for portal_type in sensitive_portal_type_list:\n
error_list.append(\'Portal Type %s still contains the category %s\' % (portal_type, old_category_name))\n error_list.append(\'Portal Type %s still contains the category %s\' % (portal_type, old_category_name))\n
\n \n
return error_list\n return error_list\n
......
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