Commit c38c6e92 authored by Jérome Perrin's avatar Jérome Perrin

new category import by Thomas Nouret

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27079 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 87f44b77
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>return context.REQUEST.other.get(\'category_import_report\', [])\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CategoryTool_getImportReportFromRequest</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -55,17 +55,8 @@
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Message import translateString\n
from Products.ERP5Type.Document import newTempBase\n
from Products.ERP5Type.DateUtils import getIntervalBetweenDates\n
\n
# Initialise some general variables\n
import_file = context.REQUEST[\'import_file\']\n
update_existing_property = context.REQUEST[\'update_existing_property\']\n
detailed_report = context.REQUEST[\'detailed_report\']\n
simulation_mode = context.REQUEST[\'simulation_mode\']\n
displayed_report = context.REQUEST[\'displayed_report\']\n
effective_date = context.REQUEST[\'effective_date\']\n
expiration_date = context.REQUEST[\'expiration_date\']\n
existing_category_list = context.REQUEST[\'existing_category_list\']\n
detailed_report_result = []\n
detailed_report_append = detailed_report_result.append\n
base_category_id_list = []\n
......@@ -123,8 +114,10 @@ def invalid_category_spreadsheet_handler(message):\n
\n
category_list_spreadsheet_mapping = context.Base_getCategoriesSpreadSheetMapping(import_file,\n
invalid_spreadsheet_error_handler=invalid_category_spreadsheet_handler, simulation_mode=simulation_mode)\n
\n
if category_list_spreadsheet_mapping.has_key(\'error_list\'):\n
return category_list_spreadsheet_mapping[\'error_list\']\n
context.REQUEST.other[\'category_import_report\'] = category_list_spreadsheet_mapping[\'error_list\']\n
return context.CategoryTool_viewImportReport()\n
\n
for base_category, category_list in \\\n
category_list_spreadsheet_mapping.items():\n
......@@ -223,7 +216,9 @@ for base_category, category_list in \\\n
report_line.edit(field_type = \'\', field_category = \'\', field_message = translateString("Updated ${key} with value ${value} ", mapping=dict(key=key, value=value))) \n
detailed_report_append(report_line)\n
elif value not in (\'\', None) and not new_category.hasProperty(key):\n
context.log(new_category.getProperty(key))\n
# Only set properties which are not already defined\n
context.log(new_category.hasProperty(key))\n
category_update_dict[key] = value\n
if \'updated\' in displayed_report:\n
if first_update_reported:\n
......@@ -302,7 +297,8 @@ if not simulation_mode:\n
\n
if (detailed_report or simulation_mode) and detailed_report_result:\n
# Return a detailed report if requested\n
return detailed_report_result\n
context.REQUEST.other[\'category_import_report\'] = detailed_report_result\n
return context.CategoryTool_viewImportReport()\n
\n
# Import is a success, go back to the portal_categories tool\n
return context.REQUEST.RESPONSE.redirect(\n
......@@ -331,7 +327,7 @@ return context.REQUEST.RESPONSE.redirect(\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>import_file, update_existing_property=False, keep_existing_category=True, detailed_report=False, simulation_mode=False, displayed_report=[], effective_date, expiration_date, existing_category_list=\'keep\', **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -351,35 +347,33 @@ return context.REQUEST.RESPONSE.redirect(\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
<value> <int>9</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>Products.ERP5Type.Message</string>
<string>translateString</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>Products.ERP5Type.DateUtils</string>
<string>getIntervalBetweenDates</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>context</string>
<string>import_file</string>
<string>update_existing_property</string>
<string>keep_existing_category</string>
<string>detailed_report</string>
<string>simulation_mode</string>
<string>displayed_report</string>
<string>effective_date</string>
<string>expiration_date</string>
<string>existing_category_list</string>
<string>kw</string>
<string>Products.ERP5Type.Message</string>
<string>translateString</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>detailed_report_result</string>
<string>_getattr_</string>
<string>detailed_report_append</string>
<string>base_category_id_list</string>
<string>category_path_dict</string>
<string>simulation_new_category_id_list</string>
<string>context</string>
<string>property_id_list</string>
<string>AttributeError</string>
<string>report_line</string>
......@@ -396,6 +390,8 @@ return context.REQUEST.RESPONSE.redirect(\n
<string>filename</string>
<string>invalid_category_spreadsheet_handler</string>
<string>category_list_spreadsheet_mapping</string>
<string>_getitem_</string>
<string>_write_</string>
<string>_getiter_</string>
<string>base_category</string>
<string>category_list</string>
......@@ -416,7 +412,6 @@ return context.REQUEST.RESPONSE.redirect(\n
<string>category_type</string>
<string>dict</string>
<string>None</string>
<string>_write_</string>
<string>new_category</string>
<string>category_update_dict</string>
<string>first_update_reported</string>
......@@ -438,7 +433,16 @@ return context.REQUEST.RESPONSE.redirect(\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
<int>1</int>
<int>0</int>
<int>0</int>
<list/>
<none/>
<none/>
<string>keep</string>
</tuple>
</value>
</item>
<item>
......
......@@ -38,7 +38,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>CategoryTool_viewImportReport</string> </value>
<value> <string>CategoryTool_importCategoryFile</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -220,23 +220,23 @@
<value>
<list>
<tuple>
<string>Kept categories</string>
<string>Kept Categories</string>
<string>kept</string>
</tuple>
<tuple>
<string>Expired categories</string>
<string>Expired Categories</string>
<string>expired</string>
</tuple>
<tuple>
<string>Deleted categories</string>
<string>Deleted Categories</string>
<string>deleted</string>
</tuple>
<tuple>
<string>Created categories</string>
<string>Created Categories</string>
<string>created</string>
</tuple>
<tuple>
<string>Updated categories</string>
<string>Updated Categories</string>
<string>updated</string>
</tuple>
<tuple>
......@@ -256,7 +256,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>What do you want to see in your Report?</string> </value>
<value> <string>What Do You Want To See In Your Report?</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
......
......@@ -340,7 +340,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Effective date</string> </value>
<value> <string>Effective Date</string> </value>
</item>
</dictionary>
</value>
......
......@@ -223,15 +223,15 @@
<value>
<list>
<tuple>
<string>Keep categories</string>
<string>Keep Categories</string>
<string>keep</string>
</tuple>
<tuple>
<string>Expire categories</string>
<string>Expire Categories</string>
<string>expire</string>
</tuple>
<tuple>
<string>Delete categories</string>
<string>Delete Categories</string>
<string>delete</string>
</tuple>
</list>
......@@ -247,7 +247,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>What to do with existing categories?</string> </value>
<value> <string>What To Do With Existing Categories?</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
......
......@@ -340,7 +340,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Expiration date (optional)</string> </value>
<value> <string>Expiration Date (Optional)</string> </value>
</item>
</dictionary>
</value>
......
......@@ -160,7 +160,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Simulation mode</string> </value>
<value> <string>Simulation Mode</string> </value>
</item>
</dictionary>
</value>
......
......@@ -83,9 +83,7 @@
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>listbox</string>
</list>
<list/>
</value>
</item>
<item>
......@@ -97,7 +95,9 @@
<item>
<key> <string>left</string> </key>
<value>
<list/>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
......
......@@ -451,10 +451,6 @@
<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>
<value> <int>0</int> </value>
......@@ -541,7 +537,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>CategoryTool_importCategoryFile</string> </value>
<value> <string>CategoryTool_getImportReportFromRequest</string> </value>
</item>
</dictionary>
</pickle>
......
1205
\ No newline at end of file
1206
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment