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
selection_index=kw[\'selection_index\'],\n
uids=kw.get(\'uids\', ()),\n
listbox_uid=kw.get(\'listbox_uid\', None),\n
form_pickle=kw[\'form_pickle\'],\n
form_signature=kw[\'form_signature\'])\n
saved_form_data=kw[\'saved_form_data\'])\n
# Exception for create relation\n
if dialog_method == \'Base_createRelation\':\n
return context.Base_createRelation(form_id=kw[\'form_id\'],\n
......@@ -146,16 +145,8 @@ if dialog_method == \'Folder_delete\':\n
uids=kw[\'listbox_uid\'],\n
md5_object_uid_list=kw[\'md5_object_uid_list\'])\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
form = getattr(context, dialog_id)\n
# form can be a python script that returns the form\n
if not hasattr(form, \'validate_all_to_request\'):\n
form = form()\n
......@@ -217,16 +208,6 @@ if len(listbox_id_list):\n
listbox_line_list = tuple(listbox_line_list)\n
kw[listbox_id] = request_form[listbox_id] = listbox_line_list\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
# Check if the selection changed\n
if hasattr(kw, \'previous_md5_object_uid_list\'):\n
......@@ -309,7 +290,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
</item>
<item>
<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>
<key> <string>errors</string> </key>
......@@ -329,7 +310,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>4</int> </value>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -338,7 +319,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>dialog_method</string>
<string>dialog_id</string>
<string>dialog_category</string>
<string>enable_pickle</string>
<string>kw</string>
<string>isListBox</string>
<string>Products.Formulator.Errors</string>
......@@ -352,8 +332,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>_getitem_</string>
<string>value</string>
<string>None</string>
<string>_apply_</string>
<string>form_context</string>
<string>getattr</string>
<string>form</string>
<string>hasattr</string>
......@@ -380,11 +358,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>key</string>
<string>listbox_line</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>map</string>
<string>object_uid_list</string>
......@@ -396,6 +369,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<string>clean_kw</string>
<string>url_params_string</string>
<string>dialog_form</string>
<string>_apply_</string>
<string>redirect_url</string>
</tuple>
</value>
......@@ -410,7 +384,6 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
<value>
<tuple>
<string></string>
<int>0</int>
</tuple>
</value>
</item>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -70,18 +67,22 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# Updates attributes of an Zope document\n
# which is in a class inheriting from ERP5 Base\n
# Updates relation of an ERP5 document\n
from Products.ERP5Type.Message import Message\n
from Products.Formulator.Errors import ValidationError\n
\n
# XXX: Harcoded value, which must be taken from RelationField.py\n
# XXX why not import it then ???\n
SUB_FIELD_ID = \'relation\'\n
\n
if listbox_uid is not None:\n
selected_uids = context.portal_selections.updateSelectionCheckedUidList(selection_name, listbox_uid, uids)\n
uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n
old_request = context.portal_selections.getObjectFromPickleAndSignature(form_pickle, form_signature)\n
selection_tool = context.getPortalObject().portal_selections\n
selected_uids = selection_tool.updateSelectionCheckedUidList(\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_key = field.generate_field_key()\n
if old_request.has_key(\'sub_index\'):\n
......@@ -93,10 +94,14 @@ else:\n
# XXX Not very dynamic...\n
sub_field_key = field.generate_subfield_key(SUB_FIELD_ID, key=field_key)\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
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
selection_index=old_request.get(\'selection_index\', 0),\n
selection_name=old_request.get(\'selection_name\', \'\'))\n
......@@ -118,7 +123,7 @@ return context.Base_edit(form_id,\n
</item>
<item>
<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>
<key> <string>errors</string> </key>
......@@ -138,7 +143,7 @@ return context.Base_edit(form_id,\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>10</int> </value>
<value> <int>9</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -150,8 +155,7 @@ return context.Base_edit(form_id,\n
<string>selection_name</string>
<string>uids</string>
<string>listbox_uid</string>
<string>form_pickle</string>
<string>form_signature</string>
<string>saved_form_data</string>
<string>batch_mode</string>
<string>object_uid</string>
<string>Products.ERP5Type.Message</string>
......@@ -162,7 +166,9 @@ return context.Base_edit(form_id,\n
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>selection_tool</string>
<string>selected_uids</string>
<string>dict</string>
<string>old_request</string>
<string>getattr</string>
<string>field</string>
......@@ -172,6 +178,8 @@ return context.Base_edit(form_id,\n
<string>sub_field_key</string>
<string>str</string>
<string>_write_</string>
<string>container</string>
<string>request</string>
<string>request_form</string>
<string>_getiter_</string>
<string>k</string>
......
584
\ No newline at end of file
586
\ 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