Commit 673d136b authored by Christophe Dumez's avatar Christophe Dumez

- added exception catching to clean tmp dir when it crashes (reported by Fabien)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7380 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d98553cd
...@@ -45,9 +45,10 @@ from cStringIO import StringIO ...@@ -45,9 +45,10 @@ from cStringIO import StringIO
from tempfile import mktemp from tempfile import mktemp
from shutil import copy from shutil import copy
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5.Document.BusinessTemplate import removeAll from Products.ERP5.Document.BusinessTemplate import removeAll, TemplateConditionError
from xml.sax.saxutils import escape from xml.sax.saxutils import escape
from dircache import listdir from dircache import listdir
from OFS.Traversable import NotFound
try: try:
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
...@@ -1040,12 +1041,17 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -1040,12 +1041,17 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
bt.build() bt.build()
svn_path = self._getWorkingPath(self.getSubversionPath(bt) + os.sep) svn_path = self._getWorkingPath(self.getSubversionPath(bt) + os.sep)
path = mktemp() + os.sep path = mktemp() + os.sep
bt.export(path=path, local=1) try:
# svn del deleted files bt.export(path=path, local=1)
self.deleteOldFiles(svn_path, path, bt) # svn del deleted files
# add new files and copy self.deleteOldFiles(svn_path, path, bt)
self.addNewFiles(svn_path, path, bt) # add new files and copy
self.goToWorkingCopy(bt) self.addNewFiles(svn_path, path, bt)
self.goToWorkingCopy(bt)
except (pysvn.ClientError, NotFound, AttributeError, AttributeError, Error), error:
# Clean up
self.activate().removeAllInList([path,])
raise error
# Clean up # Clean up
self.activate().removeAllInList([path,]) self.activate().removeAllInList([path,])
......
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