[Erp5-report] r9081 - /erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Aug 8 11:15:29 CEST 2006


Author: chris
Date: Tue Aug  8 11:15:27 2006
New Revision: 9081

URL: http://svn.erp5.org?rev=9081&view=rev
Log:
- Removed FileUpload objects from request before pickling to avoid problems

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_callDialogMethod.xml

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_callDialogMethod.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_callDialogMethod.xml?rev=9081&r1=9080&r2=9081&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_callDialogMethod.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_callDialogMethod.xml Tue Aug  8 11:15:27 2006
@@ -80,6 +80,17 @@
 \n
 request_form = context.REQUEST.form\n
 error_message = \'\'\n
+\n
+def removeUnpickableObjectsFromDict(request_form):\n
+  """\n
+   Known unpickable objects:\n
+    - <ZPublisher.HTTPRequest.FileUpload instance>\n
+  """\n
+  cleaned_dict = request_form.copy()\n
+  for k, v in cleaned_dict.items():\n
+    if v in (None, \'\') or hasattr(v, \'read\'):\n
+      del cleaned_dict[k]\n
+  return cleaned_dict\n
 \n
 # Make this script work alike wether called from another script or by a request\n
 # Reinject parameters in the request\n
@@ -206,7 +217,10 @@
     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
+  #############################################\n
+  context.log(\'request_form\', request_form)\n
+  request_form_cleaned = removeUnpickableObjectsFromDict(request_form)\n
+  request_form[\'pickle_string\'] = context.portal_selections.getPickle(**request_form_cleaned)\n
 \n
 # Check if the selection changed\n
 if hasattr(request_form, \'previous_md5_object_uid_list\'):\n
@@ -324,6 +338,7 @@
                             <string>context</string>
                             <string>request_form</string>
                             <string>error_message</string>
+                            <string>removeUnpickableObjectsFromDict</string>
                             <string>_write_</string>
                             <string>_getiter_</string>
                             <string>k</string>
@@ -353,6 +368,7 @@
                             <string>key</string>
                             <string>listbox_line</string>
                             <string>tuple</string>
+                            <string>request_form_cleaned</string>
                             <string>selection_list</string>
                             <string>map</string>
                             <string>object_uid_list</string>




More information about the Erp5-report mailing list