[Erp5-report] r41710 nicolas - /erp5/trunk/products/ERP5/Tool/ContributionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 23 15:21:47 CET 2010


Author: nicolas
Date: Thu Dec 23 15:21:47 2010
New Revision: 41710

URL: http://svn.erp5.org?rev=41710&view=rev
Log:
Fix handling of container and container_path parameters.
container is persistent and can not be passed in activities.

Point out by JPS

Modified:
    erp5/trunk/products/ERP5/Tool/ContributionTool.py

Modified: erp5/trunk/products/ERP5/Tool/ContributionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/ContributionTool.py?rev=41710&r1=41709&r2=41710&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] Thu Dec 23 15:21:47 2010
@@ -132,6 +132,11 @@ class ContributionTool(BaseTool):
       del input_parameter_dict['file']
     if 'data' in input_parameter_dict:
       del input_parameter_dict['data']
+    if 'container' in input_parameter_dict:
+      # Container is a persistent object
+      # keep only its path in container_path key
+      container = input_parameter_dict.pop('container')
+      input_parameter_dict['container_path'] = container.getPath()
     # pop: remove keys which are not document properties
     url = kw.pop('url', None)
     container = kw.pop('container', None)
@@ -150,6 +155,10 @@ class ContributionTool(BaseTool):
 
     document = None
     portal = self.getPortalObject()
+    if container is None and container_path:
+      # Get persistent object from its path.
+      # Container may disappear, be smoother by passing default value
+      container = portal.restrictedTraverse(container_path, None)
     # Try to find the filename
     content_type = None
     if not url:



More information about the Erp5-report mailing list