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