From e2b6ba718af9de4becb9e152ca63a8ccf4289c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Tue, 16 Dec 2008 14:32:55 +0000 Subject: [PATCH] detect duplicates IDs when importing categories git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24906 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_core/Base_getCategoriesSpreadSheetMapping.xml | 9 +++++++++ product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml index 89a9d39e81..caf87226c0 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml @@ -247,6 +247,14 @@ for table_name in spreadsheets.keys():\n # (i.e. its tranformation to ID is not the same as the original value)\n if clean_title != cell_id:\n category_properties[\'title\'] = clean_title\n +\n + # Detect duplicate IDs\n + #if path_elements and path_elements[-1][\'depth\'] == element_depth:\n + for element in path_elements[::-1]:\n + if element[\'depth\'] != element_depth:\n + break\n + if element[\'value\'] == path_element_id:\n + raise ValueError("Duplicate id %s" % element[\'value\'])\n \n # Save the path element\n path_elements.append({ \'depth\': element_depth\n @@ -355,6 +363,7 @@ return categories_spreadsheet_mapping\n <string>element</string> <string>path</string> <string>clean_title</string> + <string>ValueError</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 487d273dda..337488c9dc 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -1040 \ No newline at end of file +1042 \ No newline at end of file -- 2.30.9