[Erp5-report] r24911 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplateItem/p...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Dec 16 18:19:27 CET 2008


Author: jerome
Date: Tue Dec 16 18:19:26 2008
New Revision: 24911

URL: http://svn.erp5.org?rev=24911&view=rev
Log:
Also report invalid IDs in category spread sheet import

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.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=24911&r1=24910&r2=24911&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 Dec 16 18:19:26 2008
@@ -90,6 +90,13 @@
 if invalid_spreadsheet_error_handler is None:\n
   invalid_spreadsheet_error_handler = default_invalid_spreadsheet_error_handler\n
 \n
+try:\n
+  property_id_list = context.portal_classes.getPropertySheetPropertyIdList()\n
+except AttributeError:\n
+  # Class tool is too old\n
+  property_id_list = []\n
+\n
+\n
 def getIDFromString(string=None):\n
   """\n
     This function transform a string to a safe and beautiful ID.\n
@@ -122,6 +129,12 @@
     clean_id = clean_id[1:]\n
   while len(clean_id) > 0 and not clean_id[-1].isalnum():\n
     clean_id = clean_id[:-1]\n
+\n
+  if clean_id in property_id_list:\n
+    invalid_spreadsheet_error_handler(translateString(\n
+         "The ID ${id} is invalid, it\'s a reserved property name",\n
+         mapping=dict(id=clean_id)))\n
+\n
   return clean_id\n
 \n
 # if the file is not an open office format, try to convert it using oood\n
@@ -331,13 +344,15 @@
                             <string>categories_spreadsheet_mapping</string>
                             <string>default_invalid_spreadsheet_error_handler</string>
                             <string>None</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>property_id_list</string>
+                            <string>AttributeError</string>
                             <string>getIDFromString</string>
                             <string>content_type</string>
                             <string>hasattr</string>
-                            <string>_getattr_</string>
                             <string>Products.ERP5Type.Document</string>
                             <string>newTempOOoDocument</string>
-                            <string>context</string>
                             <string>tmp_ooo</string>
                             <string>_getiter_</string>
                             <string>ignored</string>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml?rev=24911&r1=24910&r2=24911&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_importCategoryFile.xml [utf8] Tue Dec 16 18:19:26 2008
@@ -99,6 +99,7 @@
 def invalid_category_spreadsheet_handler(message):\n
   # action taken when an invalid spreadsheet is provided.\n
   # we *raise* a Redirect, because we don\'t want the transaction to succeed\n
+  # note, we could make a dialog parameter to allow import invalid spreadsheet:\n
   raise \'Redirect\', \'%s/view?portal_status_message=%s\' % (\n
                          context.portal_categories.absolute_url(),\n
                          message)\n

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=24911&r1=24910&r2=24911&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] Tue Dec 16 18:19:26 2008
@@ -1,1 +1,1 @@
-1043
+1044




More information about the Erp5-report mailing list