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

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 11 20:18:11 CEST 2007


Author: bartek
Date: Mon Jun 11 20:18:11 2007
New Revision: 14780

URL: http://svn.erp5.org?rev=14780&view=rev
Log:
remove the object from ourselves if an exception was raised while editing it

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=14780&r1=14779&r2=14780&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py Mon Jun 11 20:18:11 2007
@@ -278,12 +278,13 @@
     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:




More information about the Erp5-report mailing list