[Erp5-report] r24007 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Oct 3 17:27:27 CEST 2008
Author: kazuhiko
Date: Fri Oct 3 17:27:23 2008
New Revision: 24007
URL: http://svn.erp5.org?rev=24007&view=rev
Log:
2008-10-03 Kazuhiko
* make missing categories for gap root in Base_importGapFile.
Modified:
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/your_gap_root_path.xml
erp5/trunk/bt5/erp5_accounting/bt/revision
Modified: 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=24007&r1=24006&r2=24007&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFile.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFile.xml Fri Oct 3 17:27:23 2008
@@ -55,22 +55,6 @@
<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
def splitCsvLine(str_line):\n
unclean_list = []\n
pieces_of_line = str_line.split(\',\')\n
@@ -105,6 +89,12 @@
return clean_list\n
\n
\n
+def getSubCategory(parent, id):\n
+ try:\n
+ return parent[id]\n
+ except KeyError:\n
+ return parent.newContent(id=id)\n
+ \n
\n
request = context.REQUEST\n
csv_file_line_list = import_file.readlines()\n
@@ -131,6 +121,9 @@
\n
object_list.append(object)\n
\n
+root = context.getPortalObject().portal_categories\n
+for path in gap_root_path.split(\'/\'):\n
+ root = getSubCategory(root, path)\n
\n
for object in object_list:\n
description = object.get(\'Description\', None) or \'\'\n
@@ -140,21 +133,14 @@
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(gap_root_path)\n
+ path = root\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, description=description)\n
+ path = getSubCategory(path, b)\n
+ path.edit(reference=gap, title=title, description=description)\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>
@@ -199,8 +185,8 @@
<string>kw</string>
<string>_print_</string>
<string>_print</string>
- <string>convertToUpperCase</string>
<string>splitCsvLine</string>
+ <string>getSubCategory</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
@@ -219,15 +205,15 @@
<string>property</string>
<string>_write_</string>
<string>_inplacevar_</string>
+ <string>root</string>
+ <string>path</string>
<string>None</string>
<string>description</string>
<string>gap</string>
<string>title</string>
<string>str</string>
- <string>root</string>
<string>b</string>
<string>a</string>
- <string>redirect_url</string>
</tuple>
</value>
</item>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/your_gap_root_path.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/your_gap_root_path.xml?rev=24007&r1=24006&r2=24007&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/your_gap_root_path.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_importGapFileForm/your_gap_root_path.xml Fri Oct 3 17:27:23 2008
@@ -196,7 +196,7 @@
</item>
<item>
<key> <string>default</string> </key>
- <value> <string>gap/country/accounting_standart</string> </value>
+ <value> <string>gap/country/accounting_standard</string> </value>
</item>
<item>
<key> <string>description</string> </key>
Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=24007&r1=24006&r2=24007&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Fri Oct 3 17:27:23 2008
@@ -1,1 +1,1 @@
-785
+786
More information about the Erp5-report
mailing list