Commit 6cafee54 authored by Christophe Dumez's avatar Christophe Dumez

- Look for the file (svn temp dir) if this file has been deleted with 'svn...

- Look for the file (svn temp dir) if this file has been deleted with 'svn del' cmd to display content


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6555 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4ca08cd3
...@@ -456,21 +456,30 @@ class SubversionTool(UniqueObject, Folder): ...@@ -456,21 +456,30 @@ class SubversionTool(UniqueObject, Folder):
# Display a file content in HTML # Display a file content in HTML
def fileHTML(self, bt, file_path): def fileHTML(self, bt, file_path):
# file = open(file_path, 'r') if os.path.exists(file_path):
# text = file.read() if os.path.isdir(file_path):
# file.close() text = "<b>"+file_path+"</b><hr>"
# # Escaping text = file_path +" is a folder!"
# text = text.replace("&", "&amp;") else:
# text = text.replace(">", "&gt;")
# text = text.replace("<", "&lt;")
# # Adding HTML stuff
# text = text.replace('\n', '<br>')
# text = text.replace('\t', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;')
# text = text.replace(' ', '&nbsp;&nbsp;')
head = "<b>"+file_path+"</b> <a href='"+self.editPath(bt, file_path)+"'><img src='imgs/edit.png' border='0'></a><hr>" head = "<b>"+file_path+"</b> <a href='"+self.editPath(bt, file_path)+"'><img src='imgs/edit.png' border='0'></a><hr>"
text = commands.getoutput('enscript -B --color --line-numbers --highlight=html --language=html -o - %s'%file_path) text = commands.getoutput('enscript -B --color --line-numbers --highlight=html --language=html -o - %s'%file_path)
text = head + '\n'.join(text.split('\n')[10:-4]) text = head + '\n'.join(text.split('\n')[10:-4])
return text return text
else:
# see if tmp file is here (svn deleted file)
if file_path[-1]=='/':
file_path=file_path[:-1]
filename = file_path.split('/')[-1]
tmp_path = '/'.join(file_path.split('/')[:-1])
tmp_path = tmp_path+'/.svn/text-base/'+filename+'.svn-base'
if os.path.exists(tmp_path):
head = "<b>"+tmp_path+"</b> (svn temporary file)<hr>"
text = commands.getoutput('enscript -B --color --line-numbers --highlight=html --language=html -o - %s'%tmp_path)
text = head + '\n'.join(text.split('\n')[10:-4])
else : # does not exist
text = "<b>"+file_path+"</b><hr>"
text = file_path +" does not exist!"
return text
security.declareProtected(Permissions.ManagePortal, 'acceptSSLServer') security.declareProtected(Permissions.ManagePortal, 'acceptSSLServer')
def acceptSSLServer(self, trust_dict, permanent=False): def acceptSSLServer(self, trust_dict, permanent=False):
......
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