Commit 990625eb authored by Jérome Perrin's avatar Jérome Perrin

Use "saved_form_data" introduced in r17787

Drop pickle_string support

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17788 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 029b0e8e
...@@ -125,8 +125,7 @@ if dialog_method == \'Base_editRelation\':\n ...@@ -125,8 +125,7 @@ if dialog_method == \'Base_editRelation\':\n
selection_index=kw[\'selection_index\'],\n selection_index=kw[\'selection_index\'],\n
uids=kw.get(\'uids\', ()),\n uids=kw.get(\'uids\', ()),\n
listbox_uid=kw.get(\'listbox_uid\', None),\n listbox_uid=kw.get(\'listbox_uid\', None),\n
form_pickle=kw[\'form_pickle\'],\n saved_form_data=kw[\'saved_form_data\'])\n
form_signature=kw[\'form_signature\'])\n
# Exception for create relation\n # Exception for create relation\n
if dialog_method == \'Base_createRelation\':\n if dialog_method == \'Base_createRelation\':\n
return context.Base_createRelation(form_id=kw[\'form_id\'],\n return context.Base_createRelation(form_id=kw[\'form_id\'],\n
...@@ -146,16 +145,8 @@ if dialog_method == \'Folder_delete\':\n ...@@ -146,16 +145,8 @@ if dialog_method == \'Folder_delete\':\n
uids=kw[\'listbox_uid\'],\n uids=kw[\'listbox_uid\'],\n
md5_object_uid_list=kw[\'md5_object_uid_list\'])\n md5_object_uid_list=kw[\'md5_object_uid_list\'])\n
\n \n
# If the request came with a pickled form, use it as context for form object search.\n
if kw.has_key(\'pickle_string\'):\n
form_context = context.asContext(context=None,\n
portal_type=context.getPortalType(),\n
**(context.portal_selections.getObjectFromPickle(kw[\'pickle_string\']))\n
)\n
else:\n
form_context = context\n
form = getattr(form_context, dialog_id)\n
\n \n
form = getattr(context, dialog_id)\n
# form can be a python script that returns the form\n # form can be a python script that returns the form\n
if not hasattr(form, \'validate_all_to_request\'):\n if not hasattr(form, \'validate_all_to_request\'):\n
form = form()\n form = form()\n
...@@ -217,16 +208,6 @@ if len(listbox_id_list):\n ...@@ -217,16 +208,6 @@ if len(listbox_id_list):\n
listbox_line_list = tuple(listbox_line_list)\n listbox_line_list = tuple(listbox_line_list)\n
kw[listbox_id] = request_form[listbox_id] = listbox_line_list\n kw[listbox_id] = request_form[listbox_id] = listbox_line_list\n
\n \n
if enable_pickle or (form.update_action != \'\'):\n
# Do not put listbox in pickle, because this pickle becomes too big\n
# wich is not compatible with the url limit size\n
pickle_kw = {}\n
excluded_key_list = listbox_id_list\n
excluded_key_list.extend(["%s_uid" % x for x in listbox_id_list])\n
for key in kw.keys():\n
if key not in excluded_key_list:\n
pickle_kw[key] = kw[key]\n
kw[\'pickle_string\'] = request_form[\'pickle_string\'] = context.portal_selections.getPickle(**pickle_kw)\n
\n \n
# Check if the selection changed\n # Check if the selection changed\n
if hasattr(kw, \'previous_md5_object_uid_list\'):\n if hasattr(kw, \'previous_md5_object_uid_list\'):\n
...@@ -309,7 +290,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -309,7 +290,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>dialog_method, dialog_id, dialog_category=\'\', enable_pickle=0, **kw</string> </value> <value> <string>dialog_method, dialog_id, dialog_category=\'\', **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -329,7 +310,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -329,7 +310,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>4</int> </value> <value> <int>3</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -338,7 +319,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -338,7 +319,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>dialog_method</string> <string>dialog_method</string>
<string>dialog_id</string> <string>dialog_id</string>
<string>dialog_category</string> <string>dialog_category</string>
<string>enable_pickle</string>
<string>kw</string> <string>kw</string>
<string>isListBox</string> <string>isListBox</string>
<string>Products.Formulator.Errors</string> <string>Products.Formulator.Errors</string>
...@@ -352,8 +332,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -352,8 +332,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>_getitem_</string> <string>_getitem_</string>
<string>value</string> <string>value</string>
<string>None</string> <string>None</string>
<string>_apply_</string>
<string>form_context</string>
<string>getattr</string> <string>getattr</string>
<string>form</string> <string>form</string>
<string>hasattr</string> <string>hasattr</string>
...@@ -380,11 +358,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -380,11 +358,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>key</string> <string>key</string>
<string>listbox_line</string> <string>listbox_line</string>
<string>tuple</string> <string>tuple</string>
<string>pickle_kw</string>
<string>excluded_key_list</string>
<string>append</string>
<string>$append0</string>
<string>x</string>
<string>selection_list</string> <string>selection_list</string>
<string>map</string> <string>map</string>
<string>object_uid_list</string> <string>object_uid_list</string>
...@@ -396,6 +369,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -396,6 +369,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>clean_kw</string> <string>clean_kw</string>
<string>url_params_string</string> <string>url_params_string</string>
<string>dialog_form</string> <string>dialog_form</string>
<string>_apply_</string>
<string>redirect_url</string> <string>redirect_url</string>
</tuple> </tuple>
</value> </value>
...@@ -410,7 +384,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -410,7 +384,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<value> <value>
<tuple> <tuple>
<string></string> <string></string>
<int>0</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -70,18 +67,22 @@ ...@@ -70,18 +67,22 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
# Updates attributes of an Zope document\n # Updates relation of an ERP5 document\n
# which is in a class inheriting from ERP5 Base\n
from Products.ERP5Type.Message import Message\n from Products.ERP5Type.Message import Message\n
from Products.Formulator.Errors import ValidationError\n from Products.Formulator.Errors import ValidationError\n
\n \n
# XXX: Harcoded value, which must be taken from RelationField.py\n # XXX: Harcoded value, which must be taken from RelationField.py\n
# XXX why not import it then ???\n
SUB_FIELD_ID = \'relation\'\n SUB_FIELD_ID = \'relation\'\n
\n \n
if listbox_uid is not None:\n if listbox_uid is not None:\n
selected_uids = context.portal_selections.updateSelectionCheckedUidList(selection_name, listbox_uid, uids)\n selection_tool = context.getPortalObject().portal_selections\n
uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n selected_uids = selection_tool.updateSelectionCheckedUidList(\n
old_request = context.portal_selections.getObjectFromPickleAndSignature(form_pickle, form_signature)\n selection_name, listbox_uid, uids)\n
uids = selection_tool.getSelectionCheckedUidsFor(selection_name)\n
\n
old_request = dict(saved_form_data)\n
\n
field = getattr(context, form_id).get_field(field_id)\n field = getattr(context, form_id).get_field(field_id)\n
field_key = field.generate_field_key()\n field_key = field.generate_field_key()\n
if old_request.has_key(\'sub_index\'):\n if old_request.has_key(\'sub_index\'):\n
...@@ -93,10 +94,14 @@ else:\n ...@@ -93,10 +94,14 @@ else:\n
# XXX Not very dynamic...\n # XXX Not very dynamic...\n
sub_field_key = field.generate_subfield_key(SUB_FIELD_ID, key=field_key)\n sub_field_key = field.generate_subfield_key(SUB_FIELD_ID, key=field_key)\n
old_request[sub_field_key] = uids\n old_request[sub_field_key] = uids\n
request_form = context.REQUEST.form\n \n
\n
request = container.REQUEST\n
request_form = request.form\n
for k in request_form.keys():\n for k in request_form.keys():\n
del request_form[k]\n del request_form[k]\n
request_form.update(old_request)\n \n
request.form.update(old_request)\n
return context.Base_edit(form_id,\n return context.Base_edit(form_id,\n
selection_index=old_request.get(\'selection_index\', 0),\n selection_index=old_request.get(\'selection_index\', 0),\n
selection_name=old_request.get(\'selection_name\', \'\'))\n selection_name=old_request.get(\'selection_name\', \'\'))\n
...@@ -118,7 +123,7 @@ return context.Base_edit(form_id,\n ...@@ -118,7 +123,7 @@ return context.Base_edit(form_id,\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>form_id, field_id, selection_index, selection_name, uids, listbox_uid, form_pickle, form_signature, batch_mode=0, object_uid=0</string> </value> <value> <string>form_id, field_id, selection_index, selection_name, uids, listbox_uid, saved_form_data, batch_mode=0, object_uid=0</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -138,7 +143,7 @@ return context.Base_edit(form_id,\n ...@@ -138,7 +143,7 @@ return context.Base_edit(form_id,\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>10</int> </value> <value> <int>9</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -150,8 +155,7 @@ return context.Base_edit(form_id,\n ...@@ -150,8 +155,7 @@ return context.Base_edit(form_id,\n
<string>selection_name</string> <string>selection_name</string>
<string>uids</string> <string>uids</string>
<string>listbox_uid</string> <string>listbox_uid</string>
<string>form_pickle</string> <string>saved_form_data</string>
<string>form_signature</string>
<string>batch_mode</string> <string>batch_mode</string>
<string>object_uid</string> <string>object_uid</string>
<string>Products.ERP5Type.Message</string> <string>Products.ERP5Type.Message</string>
...@@ -162,7 +166,9 @@ return context.Base_edit(form_id,\n ...@@ -162,7 +166,9 @@ return context.Base_edit(form_id,\n
<string>None</string> <string>None</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>selection_tool</string>
<string>selected_uids</string> <string>selected_uids</string>
<string>dict</string>
<string>old_request</string> <string>old_request</string>
<string>getattr</string> <string>getattr</string>
<string>field</string> <string>field</string>
...@@ -172,6 +178,8 @@ return context.Base_edit(form_id,\n ...@@ -172,6 +178,8 @@ return context.Base_edit(form_id,\n
<string>sub_field_key</string> <string>sub_field_key</string>
<string>str</string> <string>str</string>
<string>_write_</string> <string>_write_</string>
<string>container</string>
<string>request</string>
<string>request_form</string> <string>request_form</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>k</string> <string>k</string>
......
584 586
\ No newline at end of file \ 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