[Erp5-report] r10743 - /erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/porta...
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Oct 16 14:33:58 CEST 2006
Author: vincent
Date: Mon Oct 16 14:33:56 2006
New Revision: 10743
URL: http://svn.erp5.org?rev=10743&view=rev
Log:
The central valirable must be kw, not request_form, to pass arguments away - but keep resuqet_form updated when kw is, for compatibility.
Fix selection_name being accessed directly although not defined : grab it from kw.
Modified:
erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml?rev=10743&r1=10742&r2=10743&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_callDialogMethod.xml Mon Oct 16 14:33:56 2006
@@ -82,35 +82,28 @@
error_message = \'\'\n
\n
# Make this script work alike wether called from another script or by a request\n
-# Reinject parameters in the request\n
-request_form[\'dialog_method\'] = dialog_method\n
-request_form[\'dialog_id\'] = dialog_id\n
-request_form[\'dialog_category\'] = dialog_category\n
-request_form[\'enable_pickle\'] = enable_pickle\n
-# If we get unused parameters, put them in the request\n
-for k, v in kw:\n
- request_form[k]=v\n
+kw.update(request_form)\n
\n
# Exceptions for UI\n
if dialog_method == \'Base_configureUI\':\n
- return context.Base_configureUI(form_id=request_form[\'form_id\'],\n
- selection_name=request_form[\'selection_name\'],\n
- field_columns=request_form[\'field_columns\'],\n
- stat_columns=request_form[\'stat_columns\'])\n
+ return context.Base_configureUI(form_id=kw[\'form_id\'],\n
+ selection_name=kw[\'selection_name\'],\n
+ field_columns=kw[\'field_columns\'],\n
+ stat_columns=kw[\'stat_columns\'])\n
# Exceptions for Sort\n
if dialog_method == \'Base_configureSortOn\':\n
- return context.Base_configureSortOn(form_id=request_form[\'form_id\'],\n
- selection_name=request_form[\'selection_name\'],\n
- field_sort_on=request_form[\'field_sort_on\'],\n
- field_sort_order=request_form[\'field_sort_order\'])\n
+ return context.Base_configureSortOn(form_id=kw[\'form_id\'],\n
+ selection_name=kw[\'selection_name\'],\n
+ field_sort_on=kw[\'field_sort_on\'],\n
+ field_sort_order=kw[\'field_sort_order\'])\n
# Exceptions for Base_edit\n
# if dialog_method == \'Base_edit\':\n
-# return context.Base_edit(form_id=request_form[\'form_id\'],\n
+# return context.Base_edit(form_id=kw[\'form_id\'],\n
# dialog_id=dialog_id,\n
-# selection_name=request_form[\'selection_name\'])\n
+# selection_name=kw[\'selection_name\'])\n
# Exceptions for Workflow\n
if dialog_method == \'Workflow_statusModify\':\n
- value = context.Workflow_statusModify(form_id=request_form[\'form_id\'],\n
+ value = context.Workflow_statusModify(form_id=kw[\'form_id\'],\n
dialog_id=dialog_id)\n
# XXX: This test is related to erp5_web and should not be present in configuration where it is not installed.\n
if not(getattr(context.REQUEST, \'ignore_layout\', 0)) and context.getApplicableLayout() :\n
@@ -118,38 +111,38 @@
return value\n
# Exception for edit relation\n
if dialog_method == \'Base_editRelation\':\n
- return context.Base_editRelation(form_id=request_form[\'form_id\'],\n
- field_id=request_form[\'field_id\'],\n
- selection_name=request_form[\'selection_name\'],\n
- selection_index=request_form[\'selection_index\'],\n
- uids=request_form.get(\'uids\', ()),\n
- listbox_uid=request_form.get(\'listbox_uid\', None),\n
- form_pickle=request_form[\'form_pickle\'],\n
- form_signature=request_form[\'form_signature\'])\n
+ return context.Base_editRelation(form_id=kw[\'form_id\'],\n
+ field_id=kw[\'field_id\'],\n
+ selection_name=kw[\'selection_name\'],\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
# Exception for create relation\n
if dialog_method == \'Base_createRelation\':\n
- return context.Base_createRelation(form_id=request_form[\'form_id\'],\n
- selection_name=request_form[\'selection_name\'],\n
- selection_index=request_form[\'selection_index\'],\n
- base_category=request_form[\'base_category\'],\n
- object_uid=request_form[\'object_uid\'],\n
- catalog_index=request_form[\'catalog_index\'],\n
- default_module=request_form[\'default_module\'],\n
+ return context.Base_createRelation(form_id=kw[\'form_id\'],\n
+ selection_name=kw[\'selection_name\'],\n
+ selection_index=kw[\'selection_index\'],\n
+ base_category=kw[\'base_category\'],\n
+ object_uid=kw[\'object_uid\'],\n
+ catalog_index=kw[\'catalog_index\'],\n
+ default_module=kw[\'default_module\'],\n
dialog_id=dialog_id,\n
- portal_type=request_form[\'portal_type\'],\n
- return_url=request_form[\'cancel_url\'])\n
+ portal_type=kw[\'portal_type\'],\n
+ return_url=kw[\'cancel_url\'])\n
# Exception for folder delete\n
if dialog_method == \'Folder_delete\':\n
- return context.Folder_delete(form_id=request_form[\'form_id\'],\n
- selection_name=request_form[\'selection_name\'],\n
- uids=request_form[\'listbox_uid\'],\n
- md5_object_uid_list=request_form[\'md5_object_uid_list\'])\n
+ return context.Folder_delete(form_id=kw[\'form_id\'],\n
+ selection_name=kw[\'selection_name\'],\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 request_form.has_key(\'pickle_string\'):\n
+if kw.has_key(\'pickle_string\'):\n
form_context = context.asContext(context=None,\n
portal_type=context.getPortalType(),\n
- **(context.portal_selections.getObjectFromPickle(request_form[\'pickle_string\']))\n
+ **(context.portal_selections.getObjectFromPickle(kw[\'pickle_string\']))\n
)\n
else:\n
form_context = context\n
@@ -182,9 +175,9 @@
# Cleanup my_ and your_ prefixes\n
splitted = k.split(\'_\', 1)\n
if len(splitted) == 2 and splitted[0] in (\'my\', \'your\'):\n
- request_form[splitted[1]] = v\n
+ kw[splitted[1]] = request_form[splitted[1]] = v\n
else:\n
- request_form[k] = v\n
+ kw[k] = request_form[k] = v\n
\n
if len(listbox_id_list):\n
can_redirect = 0\n
@@ -194,7 +187,7 @@
# ... but handle them anyway.\n
for listbox_id in listbox_id_list:\n
listbox_line_list = []\n
- listbox = request_form[listbox_id]\n
+ listbox = kw[listbox_id]\n
listbox_keys = listbox.keys()\n
listbox_keys.sort()\n
for key in listbox_keys:\n
@@ -202,37 +195,37 @@
listbox_line[\'listbox_key\'] = key\n
listbox_line_list.append(listbox_line)\n
listbox_line_list = tuple(listbox_line_list)\n
- request_form[listbox_id] = listbox_line_list\n
+ kw[listbox_id] = request_form[listbox_id] = listbox_line_list\n
\n
if enable_pickle or (form.update_action != \'\'):\n
- request_form[\'pickle_string\'] = context.portal_selections.getPickle(**request_form)\n
+ kw[\'pickle_string\'] = request_form[\'pickle_string\'] = context.portal_selections.getPickle(**kw)\n
\n
# Check if the selection changed\n
-if hasattr(request_form, \'previous_md5_object_uid_list\'):\n
- selection_list = context.portal_selections.callSelectionFor(request_form[\'selection_name\'], context=context)\n
+if hasattr(kw, \'previous_md5_object_uid_list\'):\n
+ selection_list = context.portal_selections.callSelectionFor(kw[\'selection_name\'], context=context)\n
if selection_list is not None:\n
object_uid_list = map(lambda x:x.getObject().getUid(), selection_list)\n
- error = context.portal_selections.selectionHasChanged(request_form[\'previous_md5_object_uid_list\'], object_uid_list)\n
+ error = context.portal_selections.selectionHasChanged(kw[\'previous_md5_object_uid_list\'], object_uid_list)\n
if error:\n
error_message = N_("Sorry+your+selection+has+changed")\n
\n
# if dialog_category is object_search, then edit the selection\n
if dialog_category == "object_search" :\n
- context.portal_selections.setSelectionParamsFor(request_form[\'selection_name\'], request_form)\n
+ context.portal_selections.setSelectionParamsFor(kw[\'selection_name\'], kw)\n
\n
# if we have checked line in listbox, modify the selection\n
-listbox_uid = request_form.get(\'listbox_uid\', None)\n
+listbox_uid = kw.get(\'listbox_uid\', None)\n
if listbox_uid is not None:\n
- uids = request_form.get(\'uids\')\n
+ uids = kw.get(\'uids\')\n
selected_uids = context.portal_selections.updateSelectionCheckedUidList(\n
- request_form[\'selection_name\'],\n
+ kw[\'selection_name\'],\n
listbox_uid, uids)\n
\n
# Remove values which doesn\'t work with make_query.\n
clean_kw = {}\n
-for k, v in request_form.items() :\n
+for k, v in kw.items() :\n
if v not in (None, [], ()) :\n
- clean_kw[k] = request_form[k]\n
+ clean_kw[k] = kw[k]\n
\n
url_params_string = make_query(clean_kw)\n
\n
@@ -248,7 +241,7 @@
# current ListBox implementation which edit Selection\'s last_url\n
# with the content of REQUEST.URL\n
context.REQUEST.set(\'URL\', \'%s/%s\' % (context.absolute_url(), dialog_method))\n
- return dialog_form(**request_form)\n
+ return dialog_form(**kw)\n
\n
if error_message != \'\':\n
redirect_url = \'%s/%s?%s\' % ( context.absolute_url()\n
@@ -331,10 +324,6 @@
<string>context</string>
<string>request_form</string>
<string>error_message</string>
- <string>_write_</string>
- <string>_getiter_</string>
- <string>k</string>
- <string>v</string>
<string>_getitem_</string>
<string>value</string>
<string>getattr</string>
@@ -348,10 +337,14 @@
<string>MARKER</string>
<string>listbox_id_list</string>
<string>file_id_list</string>
+ <string>_getiter_</string>
<string>field</string>
+ <string>k</string>
+ <string>v</string>
<string>hasattr</string>
<string>splitted</string>
<string>len</string>
+ <string>_write_</string>
<string>log</string>
<string>listbox_id</string>
<string>listbox_line_list</string>
@@ -367,7 +360,6 @@
<string>N_</string>
<string>listbox_uid</string>
<string>uids</string>
- <string>selection_name</string>
<string>selected_uids</string>
<string>clean_kw</string>
<string>url_params_string</string>
More information about the Erp5-report
mailing list