Commit 8c61cb00 authored by Christophe Dumez's avatar Christophe Dumez

- used unical tmp dirs generated by tempfile.mktemp


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6480 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 03e0dcca
......@@ -37,6 +37,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Products.PythonScripts.Utility import allow_class
from zLOG import LOG, WARNING
from tempfile import mktemp
try:
import pysvn
......@@ -257,8 +258,11 @@ try:
def diff(self, path):
self._getPreferences()
os.system('mkdir -p /tmp/tmp-svn/')
return self.client.diff(tmp_path='/tmp/tmp-svn/', url_or_path=path, recurse=False)
tmp = mktemp()
os.system('mkdir -p %s'%tmp)
diff = self.client.diff(tmp_path=tmp, url_or_path=path, recurse=False)
os.system('rm -rf %s'%tmp)
return diff
def revert(self, path):
self._getPreferences()
......
......@@ -42,6 +42,7 @@ from App.config import getConfiguration
from zExceptions import Unauthorized
from OFS.Image import manage_addFile
from cStringIO import StringIO
from tempfile import mktemp
try:
from base64 import b64encode, b64decode
......@@ -83,6 +84,11 @@ class DiffFile:
# - new_revision
def __init__(self, raw_diff):
if '@@' not in raw_diff:
self.binary=True
return
else:
self.binary=False
self.header = raw_diff.split('@@')[0][:-1]
# Getting file path in header
self.path = self.header.split('====')[0][:-1].strip()
......@@ -124,6 +130,9 @@ class DiffFile:
def toHTML(self):
# Adding header of the table
if self.binary:
return '<b>Binary File!</b><br><br><br>'
html = '''
<table style="text-align: left; width: 100%%;" border="0" cellpadding="0" cellspacing="0">
<tbody>
......@@ -577,8 +586,9 @@ class SubversionTool(UniqueObject, Folder):
parent.sub_dirs.append(File(full_path, str(msg_status)))
return somethingModified and root
def extractBT(self, bt, path):
os.system('rm -rf %s'%path)
def extractBT(self, bt):
path = mktemp()
#os.system('rm -rf %s'%path)
bt.export(path=path, local=1)
svn_path = self.getPortalObject().portal_preferences.getPreference('subversion_working_copy')
if not svn_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