[Erp5-report] r6556 - /erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 12 15:47:45 CEST 2006
Author: chris
Date: Wed Apr 12 15:47:43 2006
New Revision: 6556
URL: http://svn.erp5.org?rev=6556&view=rev
Log:
- Improved editPath to work with directories whenever possible
- Display fix in show highlighted file content function
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=6556&r1=6555&r2=6556&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py (original)
+++ erp5/trunk/products/ERP5Subversion/Tool/SubversionTool.py Wed Apr 12 15:47:43 2006
@@ -381,19 +381,30 @@
# path is the path in svn working copy
+ # return edit_path in zodb to edit it
+ # return '#' if no zodb path is found
def editPath(self, bt, path):
"""Return path to edit file
"""
- if os.path.isdir(path):
+ if 'bt' in path.split('/'):
+ # not in zodb
return '#'
svn_path = bt.getPortalObject().portal_preferences.getPreference('subversion_working_copy')
if not svn_path:
raise 'Error: Please set working copy path in Subversion preferences !'
if svn_path[-1] != '/':
svn_path += '/'
- svn_path = svn_path + bt.getTitle() + '/'
+ svn_path = svn_path + bt.getTitle()
edit_path = path.replace(svn_path, '')
+ if edit_path.strip() == '':
+ # not in zodb
+ return '#'
+ if edit_path[0] == '/':
+ edit_path = edit_path[1:]
edit_path = '/'.join(edit_path.split('/')[1:])
+ if edit_path.strip() == '':
+ # not in zodb
+ return '#'
tmp = re.search('\\.[\w]+$', edit_path)
if tmp:
extension = tmp.string[tmp.start():tmp.end()].strip()
@@ -459,7 +470,7 @@
if os.path.exists(file_path):
if os.path.isdir(file_path):
text = "<b>"+file_path+"</b><hr>"
- text = file_path +" is a folder!"
+ 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)
@@ -478,7 +489,7 @@
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!"
+ text += file_path +" does not exist!"
return text
security.declareProtected(Permissions.ManagePortal, 'acceptSSLServer')
More information about the Erp5-report
mailing list