Commit 75ca2b4a authored by Jérome Perrin's avatar Jérome Perrin

Improve CSV import/export. Base_exportCsv doesn't use export_only by default....

Improve CSV import/export. Base_exportCsv doesn't use export_only by default. Import never change uid or id

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6307 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a7ec35e7
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
><tal:block tal:define="groups python: form.get_groups(include_empty=1);\n ><tal:block tal:define="groups python: form.get_groups(include_empty=1);\n
field_errors python: request.get(\'field_errors\',{});\n field_errors python: request.get(\'field_errors\',{});\n
dummy python: request.set(\'here\',here);\n dummy python: request.set(\'here\',here);\n
listbox python:form[\'listbox\'];" ><tal:block tal:content="python: listbox.Listbox_exportCsv()" /></tal:block></tal:block>\n listbox python:form[\'listbox\'];" ><tal:block tal:content="python: listbox.Listbox_exportCsv(export_only=request.get(\'export_only\', 1))" /></tal:block></tal:block></tal:block>
</tal:block>
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
><tal:block tal:define="groups python: form.get_groups(include_empty=1);\n ><tal:block tal:define="groups python: form.get_groups(include_empty=1);\n
field_errors python: request.get(\'field_errors\',{});\n field_errors python: request.get(\'field_errors\',{});\n
dummy python: request.set(\'here\',here);\n dummy python: request.set(\'here\',here);\n
listbox python:form[\'listbox\'];" ><tal:block tal:content="python: listbox.Listbox_exportCsv()" /></tal:block></tal:block>\n listbox python:form[\'listbox\'];" ><tal:block tal:content="python: listbox.Listbox_exportCsv(export_only=request.get(\'export_only\', 1))" /></tal:block></tal:block>\n
</tal:block> </tal:block>
]]></string> </value> ]]></string> </value>
......
...@@ -68,7 +68,12 @@ ...@@ -68,7 +68,12 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n <value> <string>request = context.REQUEST\n
\n \n
redirect_url = \'%s?%s\' % ( context.absolute_url()+\'/\'+form_id, \'portal_skin=CSV\')\n from ZTUtils import make_query\n
kw = { \'portal_skin\' : \'CSV\',\n
\'export_only\' : export_only }\n
\n
redirect_url = \'%s?%s\' % ( context.absolute_url()+\'/\'+form_id, \n
make_query(kw) )\n
\n \n
return request[ \'RESPONSE\' ].redirect( redirect_url )\n return request[ \'RESPONSE\' ].redirect( redirect_url )\n
</string> </value> </string> </value>
...@@ -85,7 +90,7 @@ return request[ \'RESPONSE\' ].redirect( redirect_url )\n ...@@ -85,7 +90,7 @@ return request[ \'RESPONSE\' ].redirect( redirect_url )\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>form_id=\'\'</string> </value> <value> <string>form_id=\'\', export_only=1</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -105,16 +110,20 @@ return request[ \'RESPONSE\' ].redirect( redirect_url )\n ...@@ -105,16 +110,20 @@ return request[ \'RESPONSE\' ].redirect( redirect_url )\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>2</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>form_id</string> <string>form_id</string>
<string>export_only</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
<string>ZTUtils</string>
<string>make_query</string>
<string>kw</string>
<string>redirect_url</string> <string>redirect_url</string>
<string>_getitem_</string> <string>_getitem_</string>
</tuple> </tuple>
...@@ -130,6 +139,7 @@ return request[ \'RESPONSE\' ].redirect( redirect_url )\n ...@@ -130,6 +139,7 @@ return request[ \'RESPONSE\' ].redirect( redirect_url )\n
<value> <value>
<tuple> <tuple>
<string></string> <string></string>
<int>1</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -73,7 +73,9 @@ ...@@ -73,7 +73,9 @@
<item> <item>
<key> <string>Default</string> </key> <key> <string>Default</string> </key>
<value> <value>
<list/> <list>
<string>your_export_only</string>
</list>
</value> </value>
</item> </item>
<item> <item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>IntegerField</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_export_only</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>
<item>
<key> <string>integer_out_of_range</string> </key>
<value> <string>The integer you entered was out of range.</string> </value>
</item>
<item>
<key> <string>not_integer</string> </key>
<value> <string>You did not enter an integer.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</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>end</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>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</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>end</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>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>whitespace_preserve</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>0</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>20</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>end</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> <int>1</int> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>start</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>your_export_only</string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>string:</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -71,12 +71,11 @@ ...@@ -71,12 +71,11 @@
if object == None:\n if object == None:\n
object = context.newContent()\n object = context.newContent()\n
\n \n
# activity doesn t support security rights yet...\n # activity doesn\'t support security rights yet...\n
for key in [\'uid\',\'id\']:\n for key in [\'uid\',\'id\']:\n
if object_property_dict.has_key(key):\n if object_property_dict.has_key(key):\n
object_property_dict.pop(key)\n object_property_dict.pop(key)\n
\n \n
\n
object.edit(**object_property_dict)\n object.edit(**object_property_dict)\n
</string> </value> </string> </value>
</item> </item>
......
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