[Erp5-report] r30927 - in /erp5/trunk/bt5/erp5_ooo_import: SkinTemplateItem/portal_skins/er...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Nov 30 14:37:36 CET 2009
Author: jerome
Date: Mon Nov 30 14:37:36 2009
New Revision: 30927
URL: http://svn.erp5.org?rev=30927&view=rev
Log:
- also support the category relative URL for categories columns
- lots of cleanups
Modified:
erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getModulePortalTypeSortedPropertyList.xml
erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFile.xml
erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFileLineDefaultScript.xml
erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/listbox.xml
erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/my_temp_file_name.xml
erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/ERP5Site_getCategoriesFullPath.xml
erp5/trunk/bt5/erp5_ooo_import/bt/revision
Modified: erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getModulePortalTypeSortedPropertyList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getModulePortalTypeSortedPropertyList.xml?rev=30927&r1=30926&r2=30927&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getModulePortalTypeSortedPropertyList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getModulePortalTypeSortedPropertyList.xml [utf8] Mon Nov 30 14:37:36 2009
@@ -59,9 +59,6 @@
property_list = []\n
\n
for portal_type in module.allowedContentTypes():\n
- #for property in portal_type.getInstancePropertyMap():\n
- #property_string = "%s.%s" % (portal_type.id, property[\'id\'])\n
- #property_list.append(property_string)\n
for property in portal_type.getInstancePropertyAndBaseCategoryList():\n
if property not in forbidden_property:\n
property_list.append((portal_type.id, property))\n
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=30927&r1=30926&r2=30927&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] Mon Nov 30 14:37:36 2009
@@ -222,7 +222,7 @@
if imported_line_property_dict not in [{}, None]:\n
tag = "OOo_import_%s" % active_process_value.getId()\n
portal_type = mapping[spreadsheet_name][0]\n
- active_process = context.activate(tag=tag,\n
+ active_object = context.activate(tag=tag,\n
priority=1,\n
activity="SQLQueue",\n
active_process=active_process_path)\n
@@ -230,7 +230,7 @@
if getattr(context, import_file_line_script, None) is None:\n
raise AttributeError, \'specified script "%s" does not exists\' % import_file_line_script\n
\n
- getattr(active_process, import_file_line_script)(context.getRelativeUrl(),\n
+ getattr(active_object, import_file_line_script)(context.getRelativeUrl(),\n
portal_type,\n
imported_line_property_dict,\n
active_process=active_process_path)\n
@@ -349,7 +349,7 @@
<string>property_value</string>
<string>property_id</string>
<string>tag</string>
- <string>active_process</string>
+ <string>active_object</string>
<string>NotImplementedError</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFileLineDefaultScript.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFileLineDefaultScript.xml?rev=30927&r1=30926&r2=30927&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFileLineDefaultScript.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_importFileLineDefaultScript.xml [utf8] Mon Nov 30 14:37:36 2009
@@ -161,7 +161,9 @@
\n
if not success:\n
# Delete the object if error occurs\n
+ # FIXME: maybe this should be an option ?\n
container.manage_delObjects([new_object.getId()])\n
+\n
return {\n
\'message\': translated_msg,\n
\'object_url\': new_object.getRelativeUrl(),\n
Modified: erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/listbox.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/listbox.xml?rev=30927&r1=30926&r2=30927&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/listbox.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/listbox.xml [utf8] Mon Nov 30 14:37:36 2009
@@ -443,12 +443,16 @@
<value> <int>0</int> </value>
</item>
<item>
+ <key> <string>hide_rows_on_no_search_criterion</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
<key> <string>lines</string> </key>
<value> <int>200</int> </value>
</item>
<item>
<key> <string>list_action</string> </key>
- <value> <string>Folder_viewContentList</string> </value>
+ <value> <string></string> </value>
</item>
<item>
<key> <string>list_method</string> </key>
@@ -489,6 +493,10 @@
<item>
<key> <string>report_tree</string> </key>
<value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>row_css_method</string> </key>
+ <value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
@@ -543,7 +551,16 @@
<item>
<key> <string>url_columns</string> </key>
<value>
- <list/>
+ <list>
+ <tuple>
+ <string>spreadsheet_name</string>
+ <string></string>
+ </tuple>
+ <tuple>
+ <string>spreadsheet_column</string>
+ <string></string>
+ </tuple>
+ </list>
</value>
</item>
<item>
Modified: erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/my_temp_file_name.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/my_temp_file_name.xml?rev=30927&r1=30926&r2=30927&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/my_temp_file_name.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_viewFileImportMappingDialog/my_temp_file_name.xml [utf8] Mon Nov 30 14:37:36 2009
@@ -194,7 +194,7 @@
</item>
<item>
<key> <string>css_class</string> </key>
- <value> <string></string> </value>
+ <value> <string>invisible</string> </value>
</item>
<item>
<key> <string>default</string> </key>
Modified: erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/ERP5Site_getCategoriesFullPath.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/ERP5Site_getCategoriesFullPath.xml?rev=30927&r1=30926&r2=30927&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/ERP5Site_getCategoriesFullPath.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/ERP5Site_getCategoriesFullPath.xml [utf8] Mon Nov 30 14:37:36 2009
@@ -53,44 +53,37 @@
</item>
<item>
<key> <string>_body</string> </key>
- <value> <string encoding="cdata"><![CDATA[
-
-# get a dict like {\'religion\': \'MRD\', \'gender\': \'M\'} and returns {\'religion\': \'MSM/MRD\', gender: \'male\'} so that \n
-# we can call an edit(category_dict) directly on the object it browse recursively the subcategories of the \n
-# category (key in the dict) and find a matching reference or title.\n
-# Christophe Dumez <christophe at nexedi.com>\n
+ <value> <string>"""Guess the path of categories, taking as input a mapping {base_category:\n
+category}, where category can be the relative_url, the title or the reference\n
+of the category\n
+"""\n
\n
-#def getMatchingCategoryUsingCodification(root_category, codification):\n
-# sub_cat_list = root_category.objectValues()\n
-# for sub_cat in sub_cat_list:\n
-# if sub_cat.getCodification() == codification:\n
-# return sub_cat\n
-# matching_cat = getMatchingCategoryUsingCodification(sub_cat, codification)\n
-# if matching_cat is not None:\n
-# return matching_cat\n
+from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
+portal = context.getPortalObject()\n
+result_dict = {}\n
\n
-result_dict = {}\n
-for category_name in category_dict.keys():\n
- subcat_code = category_dict[category_name]\n
- category_object = context.getPortalObject().portal_categories[category_name]\n
- result_list = context.portal_catalog(portal_type=\'Category\', reference=\'=\'+str(subcat_code), relative_url=category_name+\'%\')\n
- if len(result_list) != 0:\n
- result_cat_fullpath = \'/\'.join(result_list[0].getRelativeUrl().split(\'/\')[1:])\n
- result_dict[category_name]=result_cat_fullpath\n
- else:\n
- result_list = context.portal_catalog(portal_type=\'Category\', title=\'=\'+str(subcat_code), relative_url=category_name+\'%\')\n
- if len(result_list) != 0:\n
- result_cat_fullpath = \'/\'.join(result_list[0].getRelativeUrl().split(\'/\')[1:])\n
- result_dict[category_name]=result_cat_fullpath\n
- #result_cat = getMatchingCategoryUsingCodification(root_category=category_object, codification=subcat_code)\n
- #if result_cat is not None:\n
- # result_cat_fullpath = \'/\'.join(result_cat.getPath().split(\'/\')[4:])\n
- # result_dict[category_name]=result_cat_fullpath\n
+for base_category_name, category in category_dict.items():\n
+ category_object = \\\n
+ context.getPortalObject().portal_categories[base_category_name]\n
+ \n
+ category_value = category_object.restrictedTraverse(category, None)\n
+ if category_value is None:\n
+ query = ComplexQuery(\n
+ ComplexQuery(Query(title=category,\n
+ key=\'ExactMatch\'),\n
+ Query(reference=category,\n
+ key=\'ExactMatch\'),\n
+ operator=\'OR\'),\n
+ ComplexQuery(Query(relative_url=\'%s/%%\' % base_category_name)))\n
+ category_value = portal.portal_catalog.getResultValue(query=query)\n
+\n
+ if category_value is not None:\n
+ # remove base category from relative_url\n
+ result_dict[base_category_name] = \\\n
+ category_value.getRelativeUrl().split(\'/\', 1)[1]\n
\n
return result_dict\n
-
-
-]]></string> </value>
+</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
@@ -127,18 +120,21 @@
<value>
<tuple>
<string>category_dict</string>
+ <string>Products.ZSQLCatalog.SQLCatalog</string>
+ <string>Query</string>
+ <string>ComplexQuery</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>portal</string>
<string>result_dict</string>
<string>_getiter_</string>
- <string>_getattr_</string>
- <string>category_name</string>
+ <string>base_category_name</string>
+ <string>category</string>
<string>_getitem_</string>
- <string>subcat_code</string>
- <string>context</string>
<string>category_object</string>
- <string>str</string>
- <string>result_list</string>
- <string>len</string>
- <string>result_cat_fullpath</string>
+ <string>None</string>
+ <string>category_value</string>
+ <string>query</string>
<string>_write_</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_ooo_import/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ooo_import/bt/revision?rev=30927&r1=30926&r2=30927&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ooo_import/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_ooo_import/bt/revision [utf8] Mon Nov 30 14:37:36 2009
@@ -1,1 +1,1 @@
-394
+398
More information about the Erp5-report
mailing list