Commit 83ed054f authored by Christophe Dumez's avatar Christophe Dumez

- removed forgotten os.system references

- do not duplicate removeAll() function anymore (take the one from BusinessTemplates)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7190 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 289076c5
...@@ -37,6 +37,7 @@ from AccessControl import ClassSecurityInfo ...@@ -37,6 +37,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
from tempfile import mktemp from tempfile import mktemp
from Products.ERP5.Document.BusinessTemplate import removeAll
try: try:
import pysvn import pysvn
...@@ -152,7 +153,6 @@ try: ...@@ -152,7 +153,6 @@ try:
klass.security.declareObjectPublic() klass.security.declareObjectPublic()
for attr in klass.attribute_list: for attr in klass.attribute_list:
name = 'get' + convertToUpperCase(attr) name = 'get' + convertToUpperCase(attr)
print name
setattr(klass, name, Getter(attr)) setattr(klass, name, Getter(attr))
klass.security.declarePublic(name) klass.security.declarePublic(name)
InitializeClass(klass) InitializeClass(klass)
...@@ -244,13 +244,13 @@ try: ...@@ -244,13 +244,13 @@ try:
def diff(self, path, revision1, revision2): def diff(self, path, revision1, revision2):
tmp = mktemp() tmp = mktemp()
os.system('mkdir -p %s'%tmp) os.makedirs(tmp)
if not revision1 or not revision2: if not revision1 or not revision2:
diff = self.client.diff(tmp_path=tmp, url_or_path=path, recurse=False) diff = self.client.diff(tmp_path=tmp, url_or_path=path, recurse=False)
else: 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)) 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 # clean up temp dir
os.system('rm -rf %s'%tmp) removeAll(tmp)
return diff return diff
def revert(self, path, recurse=False): def revert(self, path, recurse=False):
......
...@@ -46,6 +46,7 @@ from tempfile import mktemp ...@@ -46,6 +46,7 @@ from tempfile import mktemp
from shutil import copy from shutil import copy
from zLOG import LOG from zLOG import LOG
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5.Document.BusinessTemplate import removeAll
try: try:
...@@ -72,27 +73,6 @@ class SubversionUnknownBusinessTemplateError(Exception): ...@@ -72,27 +73,6 @@ class SubversionUnknownBusinessTemplateError(Exception):
""" """
pass 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): def copytree(src, dst, symlinks=False):
"""Recursively copy a directory tree using copy(). """Recursively copy a directory tree using copy().
......
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