Commit ab4f2b54 authored by Nicolas Delaby's avatar Nicolas Delaby

Fix handling of container and container_path parameters.

container is persistent and can not be passed in activities.

Point out by JPS


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41710 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 83637a58
...@@ -132,6 +132,11 @@ class ContributionTool(BaseTool): ...@@ -132,6 +132,11 @@ class ContributionTool(BaseTool):
del input_parameter_dict['file'] del input_parameter_dict['file']
if 'data' in input_parameter_dict: if 'data' in input_parameter_dict:
del input_parameter_dict['data'] 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 # pop: remove keys which are not document properties
url = kw.pop('url', None) url = kw.pop('url', None)
container = kw.pop('container', None) container = kw.pop('container', None)
...@@ -150,6 +155,10 @@ class ContributionTool(BaseTool): ...@@ -150,6 +155,10 @@ class ContributionTool(BaseTool):
document = None document = None
portal = self.getPortalObject() 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 # Try to find the filename
content_type = None content_type = None
if not url: if not url:
......
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