[Erp5-report] r31586 jerome - in /erp5/trunk/bt5/erp5_ooo_import: SkinTemplateItem/portal_s...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jan 5 18:45:23 CET 2010


Author: jerome
Date: Tue Jan  5 18:45:22 2010
New Revision: 31586

URL: http://svn.erp5.org?rev=31586&view=rev
Log:
When no mapping is provided, simply redirect with a message. Remove some not used / not needed code

Modified:
    erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFile.xml
    erp5/trunk/bt5/erp5_ooo_import/bt/revision

Modified: erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFile.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFile.xml?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFile.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFile.xml [utf8] Tue Jan  5 18:45:22 2010
@@ -54,12 +54,10 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>from Products.ERP5Type.Document import newTempFile\n
-from Products.ERP5OOo.OOoUtils import CorruptedOOoFile\n
-from Products.ERP5.Document.Document import ConversionError\n
 from Products.ERP5OOo.OOoUtils import OOoParser\n
 import string\n
 \n
-request  = context.REQUEST\n
+request  = container.REQUEST\n
 \n
 def getSpreadsheet(file):\n
   ooo_parser = OOoParser()\n
@@ -100,14 +98,8 @@
   # First step\n
   # The purpose of this step is to read the first line of the spreadsheet_name\n
   # and to propose a mapping interface to the user\n
-  try:\n
-    spreadsheets = getSpreadsheet(import_file)\n
-  except ConversionError:\n
-    raise\n
-    return context.Base_redirect(\n
-               form_id=dialog_id,\n
-               keep_items={\n
-                 \'portal_status_message\': \'This file format is not handle.\'})\n
+  spreadsheets = getSpreadsheet(import_file)\n
+\n
   # Put the result of OOo parsing in the request\n
   request.set(\'ooo_import_spreadsheet_data\', spreadsheets)\n
 \n
@@ -181,8 +173,9 @@
         raise AttributeError, "Portal type is not the same for all columns"\n
 \n
   # If no mapping is given\n
-  if mapping == {}:\n
-    raise AttributeError, \'Mapping not found\'\n
+  if not mapping:\n
+    return context.Base_redirect(form_id=form_id,\n
+                                 keep_items={\'portal_status_message\': \'Please Define a mapping.\'})\n
 \n
   # Create the active process for all the lines\n
   active_process_value = context.portal_activities.newActiveProcess()\n
@@ -254,7 +247,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>dialog_id=None, import_file=None, import_file_line_script=\'Base_importFileLineDefaultScript\', listbox=None, **kw</string> </value>
+            <value> <string>form_id=\'view\', dialog_id=None, import_file=None, import_file_line_script=\'Base_importFileLineDefaultScript\', listbox=None, **kw</string> </value>
         </item>
         <item>
             <key> <string>_proxy_roles</string> </key>
@@ -282,12 +275,13 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>4</int> </value>
+                        <value> <int>5</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
+                            <string>form_id</string>
                             <string>dialog_id</string>
                             <string>import_file</string>
                             <string>import_file_line_script</string>
@@ -296,19 +290,17 @@
                             <string>Products.ERP5Type.Document</string>
                             <string>newTempFile</string>
                             <string>Products.ERP5OOo.OOoUtils</string>
-                            <string>CorruptedOOoFile</string>
-                            <string>Products.ERP5.Document.Document</string>
-                            <string>ConversionError</string>
                             <string>OOoParser</string>
                             <string>string</string>
                             <string>_getattr_</string>
-                            <string>context</string>
+                            <string>container</string>
                             <string>request</string>
                             <string>getSpreadsheet</string>
                             <string>cleanUid</string>
                             <string>None</string>
                             <string>len</string>
                             <string>spreadsheets</string>
+                            <string>context</string>
                             <string>session_id</string>
                             <string>_getitem_</string>
                             <string>session</string>
@@ -363,6 +355,7 @@
             <key> <string>func_defaults</string> </key>
             <value>
               <tuple>
+                <string>view</string>
                 <none/>
                 <none/>
                 <string>Base_importFileLineDefaultScript</string>

Modified: erp5/trunk/bt5/erp5_ooo_import/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ooo_import/bt/revision?rev=31586&r1=31585&r2=31586&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ooo_import/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_ooo_import/bt/revision [utf8] Tue Jan  5 18:45:22 2010
@@ -1,1 +1,1 @@
-400
+402




More information about the Erp5-report mailing list