[Erp5-report] r8294 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/erp...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jul 3 16:08:58 CEST 2006
Author: kevin
Date: Mon Jul 3 16:08:55 2006
New Revision: 8294
URL: http://svn.erp5.org?rev=8294&view=rev
Log:
Move Base_importGapFile script from gap_importer business template.
Added:
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFile.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/my_import_file.xml
Modified:
erp5/trunk/bt5/erp5_accounting/bt/change_log
Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFile.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFile.xml?rev=8294&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFile.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFile.xml Mon Jul 3 16:08:55 2006
@@ -1,0 +1,290 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <tuple>
+ <string>Products.PythonScripts.PythonScript</string>
+ <string>PythonScript</string>
+ </tuple>
+ <none/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>Python_magic</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>Script_magic</string> </key>
+ <value> <int>3</int> </value>
+ </item>
+ <item>
+ <key> <string>__ac_local_roles__</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_bind_names</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>_asgns</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>name_container</string> </key>
+ <value> <string>container</string> </value>
+ </item>
+ <item>
+ <key> <string>name_context</string> </key>
+ <value> <string>context</string> </value>
+ </item>
+ <item>
+ <key> <string>name_m_self</string> </key>
+ <value> <string>script</string> </value>
+ </item>
+ <item>
+ <key> <string>name_subpath</string> </key>
+ <value> <string>traverse_subpath</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>_body</string> </key>
+ <value> <string encoding="cdata"><![CDATA[
+
+def convertToUpperCase(key):\n
+ """\n
+ This function turns an attribute name into\n
+ a method name according to the ERP5 naming conventions\n
+ """\n
+ import string\n
+ result = \'\'\n
+ if key != \'\':\n
+ parts = string.split(str(key),\'_\')\n
+ for part in parts:\n
+ letter_list = list(part)\n
+ letter_list[0] = string.upper(letter_list[0])\n
+ result = result + string.join(letter_list,\'\')\n
+ return result\n
+\n
+\n
+\n
+def splitCsvLine(str_line):\n
+ unclean_list = []\n
+ pieces_of_line = str_line.split(\',\')\n
+\n
+ p_stack = \'\'\n
+ for p in pieces_of_line:\n
+ p_stack += p\n
+ if p_stack.count(\'"\')%2 == 0:\n
+ unclean_list.append(p_stack)\n
+ p_stack = \'\'\n
+\n
+ clean_list = []\n
+ for item in unclean_list:\n
+ clean_item = item\n
+ if clean_item.find(\'"\') != -1:\n
+ if len(clean_item) <= 2:\n
+ clean_item = \'\'\n
+ else:\n
+ clean_item = clean_item[1:]\n
+ clean_item = clean_item[:-1]\n
+ clean_item = clean_item.replace(\'""\', \'"\')\n
+ else:\n
+ if len(clean_item) > 0: \n
+ if clean_item.find(\'.\') != -1:\n
+ clean_item = float(clean_item)\n
+ else:\n
+ clean_item = int(clean_item)\n
+ else:\n
+ clean_item = None\n
+ clean_list.append(clean_item)\n
+\n
+ return clean_list\n
+\n
+\n
+\n
+request = context.REQUEST\n
+csv_file_line_list = import_file.readlines()\n
+csv_line_list = []\n
+\n
+for csv_line in csv_file_line_list:\n
+ csv_line_list.append( string.replace(csv_line, \'\\n\', \'\').decode(encoding).encode(\'utf-8\') )\n
+\n
+\n
+object_list = []\n
+\n
+csv_property_list = splitCsvLine(csv_line_list[0])\n
+csv_title_list = splitCsvLine(csv_line_list[1])\n
+\n
+\n
+for csv_line in csv_line_list[2:]:\n
+ object = {}\n
+ csv_data_list = splitCsvLine(csv_line)\n
+\n
+ data_n = 0\n
+\n
+ for property in csv_property_list:\n
+ object[property] = csv_data_list[data_n]\n
+ data_n += 1\n
+\n
+ object_list.append(object)\n
+\n
+\n
+\n
+root_path = \'gap/france/m14\'\n
+\n
+for object in object_list: \n
+ description = object.get(\'Description\', None) or None\n
+ gap = object.get(\'Gap\', None) or None\n
+ title = object.get(\'Title\', None) or None\n
+ if gap:\n
+ gap = gap.replace(\'CLASSE \', \'\')\n
+ print \'%s - %s - %s\' % (gap or \'\', title or \'\', description or \'\')\n
+ root = context.getPortalObject()\n
+ root = root.portal_categories.restrictedTraverse(root_path)\n
+ b = \'\'\n
+ for a in gap:\n
+ b = b + a\n
+ if root.has_key(b):\n
+ root = root[b]\n
+ else: \n
+ root = root.newContent(id=b)\n
+ root.edit(title = title or \'\', description = description or \'\')\n
+\n
+\n
+ #context.activate(priority=4).Base_importCsvLine(object)\n
+\n
+return printed\n
+\n
+redirect_url = \'%s?%s\' % ( context.absolute_url()+\'/\'+\'view\', \'portal_status_message=Importing+CSV+file.\')\n
+request[ \'RESPONSE\' ].redirect( redirect_url )\n
+
+
+]]></string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_filepath</string> </key>
+ <value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/Base_importGapFile</string> </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>import_file, encoding=\'iso-8859-15\', **kw</string> </value>
+ </item>
+ <item>
+ <key> <string>errors</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_code</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>co_argcount</string> </key>
+ <value> <int>2</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>import_file</string>
+ <string>encoding</string>
+ <string>kw</string>
+ <string>_print_</string>
+ <string>_print</string>
+ <string>convertToUpperCase</string>
+ <string>splitCsvLine</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>request</string>
+ <string>csv_file_line_list</string>
+ <string>csv_line_list</string>
+ <string>_getiter_</string>
+ <string>csv_line</string>
+ <string>string</string>
+ <string>object_list</string>
+ <string>_getitem_</string>
+ <string>csv_property_list</string>
+ <string>csv_title_list</string>
+ <string>object</string>
+ <string>csv_data_list</string>
+ <string>data_n</string>
+ <string>property</string>
+ <string>_write_</string>
+ <string>root_path</string>
+ <string>None</string>
+ <string>description</string>
+ <string>gap</string>
+ <string>title</string>
+ <string>root</string>
+ <string>b</string>
+ <string>a</string>
+ <string>redirect_url</string>
+ </tuple>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_defaults</string> </key>
+ <value>
+ <tuple>
+ <string>iso-8859-15</string>
+ </tuple>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>Base_importGapFile</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm.xml?rev=8294&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm.xml Mon Jul 3 16:08:55 2006
@@ -1,0 +1,135 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <tuple>
+ <string>Products.ERP5Form.Form</string>
+ <string>ERP5Form</string>
+ </tuple>
+ <none/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>__ac_local_roles__</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_bind_names</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>_asgns</string> </key>
+ <value>
+ <dictionary/>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>_objects</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>action</string> </key>
+ <value> <string>Base_importGapFile</string> </value>
+ </item>
+ <item>
+ <key> <string>encoding</string> </key>
+ <value> <string>UTF-8</string> </value>
+ </item>
+ <item>
+ <key> <string>enctype</string> </key>
+ <value> <string>multipart/form-data</string> </value>
+ </item>
+ <item>
+ <key> <string>group_list</string> </key>
+ <value>
+ <list>
+ <string>Default</string>
+ <string>hidden</string>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>groups</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>Default</string> </key>
+ <value>
+ <list>
+ <string>my_import_file</string>
+ </list>
+ </value>
+ </item>
+ <item>
+ <key> <string>hidden</string> </key>
+ <value>
+ <list/>
+ </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>Base_importGapFileForm</string> </value>
+ </item>
+ <item>
+ <key> <string>method</string> </key>
+ <value> <string>POST</string> </value>
+ </item>
+ <item>
+ <key> <string>name</string> </key>
+ <value> <string>Base_importGapFileForm</string> </value>
+ </item>
+ <item>
+ <key> <string>pt</string> </key>
+ <value> <string>form_dialog</string> </value>
+ </item>
+ <item>
+ <key> <string>row_length</string> </key>
+ <value> <int>4</int> </value>
+ </item>
+ <item>
+ <key> <string>stored_encoding</string> </key>
+ <value> <string>UTF-8</string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string>Import CSV file</string> </value>
+ </item>
+ <item>
+ <key> <string>unicode_mode</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>update_action</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/my_import_file.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/my_import_file.xml?rev=8294&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/my_import_file.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/my_import_file.xml Mon Jul 3 16:08:55 2006
@@ -1,0 +1,198 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <tuple>
+ <string>Products.Formulator.StandardFields</string>
+ <string>FileField</string>
+ </tuple>
+ <none/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>my_import_file</string> </value>
+ </item>
+ <item>
+ <key> <string>message_values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>external_validator_failed</string> </key>
+ <value> <string>The input failed the external validator.</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>overrides</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>alternate_name</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>css_class</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>default</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>description</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>display_maxwidth</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>display_width</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>editable</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>enabled</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>external_validator</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>hidden</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>tales</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>alternate_name</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>css_class</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>default</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>description</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>display_maxwidth</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>display_width</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>editable</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>enabled</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>external_validator</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>hidden</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string></string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ <item>
+ <key> <string>values</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>alternate_name</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>css_class</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>default</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>description</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>display_maxwidth</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>display_width</string> </key>
+ <value> <int>80</int> </value>
+ </item>
+ <item>
+ <key> <string>editable</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>enabled</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>external_validator</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>extra</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>hidden</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <string>Upload</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_accounting/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/change_log?rev=8294&r1=8293&r2=8294&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/change_log (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/change_log Mon Jul 3 16:08:55 2006
@@ -1,3 +1,6 @@
+2006-07-03 Kevin
+* Move Base_importGapFile script from gap_importer business template.
+
2006-06-15 Kevin
* Revert previous commit.
More information about the Erp5-report
mailing list