[Erp5-report] r6555 - /erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 12 15:17:30 CEST 2006
Author: chris
Date: Wed Apr 12 15:17:28 2006
New Revision: 6555
URL: http://svn.erp5.org?rev=6555&view=rev
Log:
- Look for the file (svn temp dir) if this file has been deleted with 'svn del' cmd to display content
Modified:
erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py
Modified: erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py?rev=6555&r1=6554&r2=6555&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py (original)
+++ erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py Wed Apr 12 15:17:28 2006
@@ -456,22 +456,31 @@
# Display a file content in HTML
def fileHTML(self, bt, file_path):
-# file = open(file_path, 'r')
-# text = file.read()
-# file.close()
-# # Escaping
-# text = text.replace("&", "&")
-# text = text.replace(">", ">")
-# text = text.replace("<", "<")
-# # Adding HTML stuff
-# text = text.replace('\n', '<br>')
-# text = text.replace('\t', ' ')
-# text = text.replace(' ', ' ')
- 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 = head + '\n'.join(text.split('\n')[10:-4])
- return text
-
+ if os.path.exists(file_path):
+ if os.path.isdir(file_path):
+ text = "<b>"+file_path+"</b><hr>"
+ text = file_path +" is a folder!"
+ else:
+ 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 = head + '\n'.join(text.split('\n')[10:-4])
+ 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')
def acceptSSLServer(self, trust_dict, permanent=False):
"""Accept a SSL server.
More information about the Erp5-report
mailing list