diff --git a/product/ERP5Subversion/SubversionClient.py b/product/ERP5Subversion/SubversionClient.py index 703e87e9741de7ef2f65c73131386daedf0e76d9..bc66f47c327f4fc0145b34a9a7d47a9382610471 100644 --- a/product/ERP5Subversion/SubversionClient.py +++ b/product/ERP5Subversion/SubversionClient.py @@ -37,6 +37,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions from Products.PythonScripts.Utility import allow_class from tempfile import mktemp +from Products.ERP5.Document.BusinessTemplate import removeAll try: import pysvn @@ -152,7 +153,6 @@ try: klass.security.declareObjectPublic() for attr in klass.attribute_list: name = 'get' + convertToUpperCase(attr) - print name setattr(klass, name, Getter(attr)) klass.security.declarePublic(name) InitializeClass(klass) @@ -244,13 +244,13 @@ try: def diff(self, path, revision1, revision2): tmp = mktemp() - os.system('mkdir -p %s'%tmp) + os.makedirs(tmp) if not revision1 or not revision2: diff = self.client.diff(tmp_path=tmp, url_or_path=path, recurse=False) else: diff = self.client.diff(tmp_path=tmp, url_or_path=path, recurse=False, revision1=pysvn.Revision(pysvn.opt_revision_kind.number,revision1), revision2=pysvn.Revision(pysvn.opt_revision_kind.number,revision2)) # clean up temp dir - os.system('rm -rf %s'%tmp) + removeAll(tmp) return diff def revert(self, path, recurse=False): diff --git a/product/ERP5Subversion/Tool/SubversionTool.py b/product/ERP5Subversion/Tool/SubversionTool.py index 222b7a180cf546f83c0a4d428565a698ab66c86d..402a8cfceb913e4888f5e2a285ac2b74d88484ca 100644 --- a/product/ERP5Subversion/Tool/SubversionTool.py +++ b/product/ERP5Subversion/Tool/SubversionTool.py @@ -46,6 +46,7 @@ from tempfile import mktemp from shutil import copy from zLOG import LOG from Products.CMFCore.utils import getToolByName +from Products.ERP5.Document.BusinessTemplate import removeAll try: @@ -71,27 +72,6 @@ class SubversionUnknownBusinessTemplateError(Exception): """The base exception class when business template is unknown. """ pass - -def removeAll(entry): - ''' - Remove all files and directories under 'entry'. - XXX: This is defined here, because os.removedirs() is buggy. - ''' - try: - if os.path.isdir(entry) and not os.path.islink(entry): - pwd = os.getcwd() - os.chmod(entry, 0755) - os.chdir(entry) - for e in os.listdir(os.curdir): - removeAll(e) - os.chdir(pwd) - os.rmdir(entry) - else: - if not os.path.islink(entry): - os.chmod(entry, 0644) - os.remove(entry) - except OSError: - pass def copytree(src, dst, symlinks=False): """Recursively copy a directory tree using copy().