----- Original Message ----- > Just to be clear, I think forward slash is / while backward slash is \.
I googled and you're right. It's so weird: not sure if I've always mixed them up till now. Thanks for the review. Jose > > -Brian > > On 06/12/2014 06:22 AM, [email protected] wrote: > > From: José Fonseca <[email protected]> > > > > It's fine for URLs to have forward slash directory separators when viewing > > the HTML on Windows. But if one moves the HTML report to a Linux machine > > or puts it on a web-server and accesses it from a Linux machine then URLs > > with forward slashes become dead. > > > > This change prevents this be replacing \ with /. > > "by" > > > > > > (There might be an easier way to achieve this than to have so many > > instances of foo.replace('\\', '/'). For example, it might be easier to > > do this replacement when loading the results. On the other hand, > > there are several places that use os.path, so it might not solve the > > issue completely neither.) > > --- > > framework/summary.py | 14 +++++++++++--- > > 1 file changed, 11 insertions(+), 3 deletions(-) > > > > diff --git a/framework/summary.py b/framework/summary.py > > index 7e8d480..e5eb156 100644 > > --- a/framework/summary.py > > +++ b/framework/summary.py > > @@ -22,6 +22,7 @@ > > from __future__ import print_function > > import os > > import os.path as path > > +import posixpath > > import itertools > > import shutil > > import collections > > @@ -46,6 +47,11 @@ def escape_filename(key): > > return re.sub(r'[<>:"|?*]', '_', key) > > > > > > +def normalize_href(href): > > + """Force backward slashes in URLs.""" > > + return href.replace('\\', '/') > > + > > + > > class HTMLIndex(list): > > """ > > Builds HTML output to be passed to the index mako template, which > > will be > > @@ -107,12 +113,13 @@ class HTMLIndex(list): > > self._newRow() > > self.append({'type': 'other', 'text': '<td />'}) > > for each in summary.results: > > + href = posixpath.join(each.name, "index.html") > > + href = normalize_href(href) > > self.append({'type': 'other', > > 'text': '<td class="head"><b>%(name)s</b><br />' > > '(<a href="%(href)s">info</a>)' > > '</td>' % {'name': each.name, > > - 'href': path.join(each.name, > > - > > "index.html")}}) > > + 'href': href}}) > > self._endRow() > > > > # Add the toplevel 'all' group > > @@ -247,7 +254,8 @@ class HTMLIndex(list): > > href = None > > else: > > css = text > > - href = path.join(group, href + ".html") > > + href = posixpath.join(group, href + ".html") > > + href = normalize_href(href) > > > > self.append({'type': 'testResult', > > 'class': css, > > > > _______________________________________________ > Piglit mailing list > [email protected] > https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/piglit&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=d7F0eZindfxMMwypMV6MArgaliIBcdV%2Fr93UXIN5sl8%3D%0A&s=0e4d70f29d16a4f041e647c71e703e76763c0e2b8d378be7e7f90b2f4952f450 > _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
