[Erp5-report] r32187 jerome - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplat...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 2 15:53:11 CET 2010


Author: jerome
Date: Tue Feb  2 15:53:10 2010
New Revision: 32187

URL: http://svn.erp5.org?rev=32187&view=rev
Log:
detect and report an error when multiple paths are defined, plus other minor style changes

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml?rev=32187&r1=32186&r2=32187&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml [utf8] Tue Feb  2 15:53:10 2010
@@ -179,7 +179,7 @@
     elif column_id in (None, \'\'):\n
       # Are we in the middle of the path definition ?\n
       # If the path definition has started and not ended\n
-      if path_def_started and path_index != None:\n
+      if path_def_started and path_index is not None:\n
         property_map[column_index] = \'path_\' + str(path_index)\n
         path_index += 1\n
       # else : The path definition is not started or is finished, so ignore the column\n
@@ -188,7 +188,7 @@
       # If there is a new column with a header and the path definition has\n
       # started, that seems the path definition has ended\n
       if \'path_0\' in property_map.values():\n
-        path_index == None\n
+        path_index == None # FIXME: useless statement, but what was the original intention ??\n
       property_map[column_index] = column_id.encode(\'utf8\')\n
     column_index += 1\n
 \n
@@ -215,13 +215,22 @@
       continue\n
 \n
     # Prefetch line datas\n
-    cell_index = 0\n
     line_data = {}\n
-    for cell in line:\n
+    path_defined = []\n
+    for cell_index, cell in enumerate(line):\n
       # Get the property corresponding to the cell data\n
       property_id = property_map[cell_index]\n
       line_data[property_id] = cell\n
-      cell_index += 1\n
+      if cell and property_id.startswith(\'path_\'):\n
+        path_defined.append(cell)\n
+        if len(path_defined) > 1:\n
+          invalid_spreadsheet_error_handler(\n
+              translateString("More that one path is defined in ${table}"\n
+              " at line ${line}: ${path_defined}",\n
+                  mapping=dict(path_defined=repr(path_defined),\n
+                               table=table_name,\n
+                               line=line_index)))\n
+\n
     # Analyse every cell of the line\n
     category_property_list = {}\n
     cell_index = 0\n
@@ -253,7 +262,7 @@
         else:\n
           path_element_id = cell_id\n
           # Initialize the list of path elements to the cell element\n
-          absolut_path_element_list = [path_element_id,]\n
+          absolute_path_element_list = [path_element_id,]\n
           # Get the depth of the current element\n
           element_depth = int(property_id[5:]) # 5 == len(\'path_\')\n
           # Get a path element for each depth level to reach the 0-level\n
@@ -262,10 +271,10 @@
             for element in path_element_list[::-1]:\n
               if element[\'depth\'] == searched_depth:\n
                 # Element found, add it to the list\n
-                absolut_path_element_list.append(element[\'value\'])\n
+                absolute_path_element_list.append(element[\'value\'])\n
                 # Get the next depth\n
                 break\n
-          path = \'/\'.join([base_category_id,] + absolut_path_element_list[::-1])\n
+          path = \'/\'.join([base_category_id,] + absolute_path_element_list[::-1])\n
           if same_type(path, u\'\'):\n
             path = path.encode(\'utf8\')\n
           category_property_list[\'path\'] = path\n
@@ -420,16 +429,19 @@
                             <string>line_index</string>
                             <string>line</string>
                             <string>len</string>
+                            <string>line_data</string>
+                            <string>path_defined</string>
+                            <string>enumerate</string>
                             <string>cell_index</string>
-                            <string>line_data</string>
                             <string>cell</string>
                             <string>property_id</string>
+                            <string>repr</string>
                             <string>category_property_list</string>
                             <string>cell_data</string>
                             <string>cell_id</string>
                             <string>alt_id_source</string>
                             <string>path_element_id</string>
-                            <string>absolut_path_element_list</string>
+                            <string>absolute_path_element_list</string>
                             <string>int</string>
                             <string>element_depth</string>
                             <string>range</string>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=32187&r1=32186&r2=32187&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] Tue Feb  2 15:53:10 2010
@@ -1,1 +1,1 @@
-1455
+1456




More information about the Erp5-report mailing list