Commit f0d644f0 authored by Bartek Górny's avatar Bartek Górny

remove the object from ourselves if an exception was raised while editing it

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14780 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2b353da5
......@@ -278,12 +278,13 @@ class ContributionTool(BaseTool):
BaseTool._setObject(self, file_name, ob)
document = BaseTool._getOb(self, file_name)
# Then edit the document contents (so that upload can happen)
document._edit(**kw)
if url: document.fromURL(url)
# Remove the object from ourselves
BaseTool._delObject(self, file_name)
try:
# Then edit the document contents (so that upload can happen)
document._edit(**kw)
if url: document.fromURL(url)
finally:
# Remove the object from ourselves
BaseTool._delObject(self, file_name)
# Move the document to where it belongs
if container_path is not None:
......
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