Commit 1f58bb48 authored by Nicolas Delaby's avatar Nicolas Delaby

Set objects inside destination container instead of set them on Tool before

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24169 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 93d836e1
...@@ -255,16 +255,20 @@ class ContributionTool(BaseTool): ...@@ -255,16 +255,20 @@ class ContributionTool(BaseTool):
ob.isIndexable = 0 ob.isIndexable = 0
# Then put the file inside ourselves for a short while # Then put the file inside ourselves for a short while
BaseTool._setObject(self, object_id, ob)
document = BaseTool._getOb(self, object_id)
if container_path is not None:
container = self.getPortalObject().restrictedTraverse(container_path)
document = self._setObject(object_id, ob, user_login=user_login, id=id,
container=container,
discover_metadata=discover_metadata,
)
document = self._getOb(object_id) # Call _getOb to purge cache
rewrite_method = document._getTypeBasedMethod('rewriteIngestionData') rewrite_method = document._getTypeBasedMethod('rewriteIngestionData')
if rewrite_method is not None: if rewrite_method is not None:
modified_kw = rewrite_method(**kw.copy()) modified_kw = rewrite_method(**kw.copy())
if modified_kw is not None: if modified_kw is not None:
kw.update(modified_kw) kw.update(modified_kw)
try:
# Then edit the document contents (so that upload can happen) # Then edit the document contents (so that upload can happen)
if 'set_filename__' in inspect.getargspec(document._edit)[0]: if 'set_filename__' in inspect.getargspec(document._edit)[0]:
# Only a few classes supports set_filename__. # Only a few classes supports set_filename__.
...@@ -273,17 +277,6 @@ class ContributionTool(BaseTool): ...@@ -273,17 +277,6 @@ class ContributionTool(BaseTool):
document._edit(**kw) document._edit(**kw)
if url: if url:
document.fromURL(url) document.fromURL(url)
finally:
# Remove the object from ourselves
BaseTool._delObject(self, object_id)
# Move the document to where it belongs
if container_path is not None:
container = self.getPortalObject().restrictedTraverse(container_path)
document = self._setObject(object_id, ob, user_login=user_login, id=id,
container=container, discover_metadata=discover_metadata,
)
document = self._getOb(object_id) # Call _getOb to purge cache
# Notify workflows # Notify workflows
#document.notifyWorkflowCreated() #document.notifyWorkflowCreated()
......
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