Commit 71c30a59 authored by Jérome Perrin's avatar Jérome Perrin

fix for virtual hosting


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20958 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 880dee63
...@@ -28,7 +28,7 @@ def traverse(ob, r, result, command_line_arguments): ...@@ -28,7 +28,7 @@ def traverse(ob, r, result, command_line_arguments):
context = text_lines[i-command_line_arguments['B'] : context = text_lines[i-command_line_arguments['B'] :
i+1+command_line_arguments['A']] i+1+command_line_arguments['A']]
path = '/'.join(ob.getPhysicalPath()) path = '/'.join(ob.getPhysicalPath())
result.append((path, "\n".join(context))) result.append((ob.absolute_url(), path, "\n".join(context)))
break break
def grep(self, pattern, A=0, B=0, r=1, i=0): def grep(self, pattern, A=0, B=0, r=1, i=0):
...@@ -42,13 +42,13 @@ def grep(self, pattern, A=0, B=0, r=1, i=0): ...@@ -42,13 +42,13 @@ def grep(self, pattern, A=0, B=0, r=1, i=0):
result = [] result = []
traverse(self, re.compile(pattern, re_flags), result, command_line_arguments) traverse(self, re.compile(pattern, re_flags), result, command_line_arguments)
html_element_list = ['<html>', '<body>'] html_element_list = ['<html>', '<body>']
for path, line in result: for url, path, line in result:
path = cgi.escape(path) path = cgi.escape(path)
line = cgi.escape(line) line = cgi.escape(line)
if ExternalEditor is None: if ExternalEditor is None:
html_element_list.append( html_element_list.append(
'<a href="%s/manage_workspace">%s</a>: %s<br/>' % '<a href="%s/manage_workspace">%s</a>: %s<br/>' %
(path, path, line.replace('\n', '<br/>'))) (url, path, line.replace('\n', '<br/>')))
else: else:
# if we have ExternalEditor installed, add the "external edit" link # if we have ExternalEditor installed, add the "external edit" link
path_element_list = path.split('/') path_element_list = path.split('/')
...@@ -56,9 +56,9 @@ def grep(self, pattern, A=0, B=0, r=1, i=0): ...@@ -56,9 +56,9 @@ def grep(self, pattern, A=0, B=0, r=1, i=0):
'/'.join(path_element_list[:-1]), path_element_list[-1]) '/'.join(path_element_list[:-1]), path_element_list[-1])
html_element_list.append( html_element_list.append(
'<a href="%s/manage_workspace">%s</a>&nbsp;<a href="%s">' '<a href="%s/manage_workspace">%s</a>&nbsp;<a href="%s">'
'<img border="0" src="/misc_/ExternalEditor/edit_icon" '\ '<img border="0" src="misc_/ExternalEditor/edit_icon" '\
'alt="externalEditor Icon"/></a> %s<br/>' 'alt="externalEditor Icon"/></a> %s<br/>'
% (path, path, external_editor_link, line.replace('\n', '<br/>'))) % (url, path, external_editor_link, line.replace('\n', '<br/>')))
html_element_list.extend(['</body>', '</html>']) html_element_list.extend(['</body>', '</html>'])
self.REQUEST.RESPONSE.setHeader('Content-Type', 'text/html') self.REQUEST.RESPONSE.setHeader('Content-Type', 'text/html')
......
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