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
try:
bt.export(path=path, local=1) bt.export(path=path, local=1)
# svn del deleted files # svn del deleted files
self.deleteOldFiles(svn_path, path, bt) self.deleteOldFiles(svn_path, path, bt)
# add new files and copy # add new files and copy
self.addNewFiles(svn_path, path, bt) self.addNewFiles(svn_path, path, bt)
self.goToWorkingCopy(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