Thanks for reviewing. I've applied all your suggestions, re-tested and took the liberty of pushing.
Jose ----- Original Message ----- > On Thursday, June 05, 2014 03:29:51 PM Ilia Mirkin wrote: > > On Thu, Jun 5, 2014 at 3:20 PM, <[email protected]> wrote: > > > From: José Fonseca <[email protected]> > > > > > > - Prevent the use of reserved characters in filenames (e.g., '>' and '<' > > > > > > which are used in several cases.) > > > > > > - Handle mixture of backward and forward slashes gracefuly. > > > --- > > > > > > framework/summary.py | 19 +++++++++++++++---- > > > 1 file changed, 15 insertions(+), 4 deletions(-) > > > > > > diff --git a/framework/summary.py b/framework/summary.py > > > index d71fb53..9cb5646 100644 > > > --- a/framework/summary.py > > > +++ b/framework/summary.py > > > @@ -40,6 +40,15 @@ __all__ = [ > > > > > > ] > > > > > > +def escapeFilename(key): > > I believe the convention is lower_underscore, not lowerCamelCase. > > (Although a few of the methods in HTMLIndex seem to disagree...) > > Please just go on pretending HTMLIndex doesn't exist :), please use > lower_underscore for variable names. > > > > > > + """ > > > + Avoid reserved characters in filenames. > > > + """ > > One line docstrings don't get new lines: > """ Avoid reserved characters in filenames """ > > > > + for c in '<>:"|?*': > > > + key = key.replace(c, '_') > > > + return key > > > > import re > > > > return re.sub(r'[<>:"|?*]', '_', key) > > +1 for this solution > > > > > > + > > > + > > > > > > class HTMLIndex(list): > > > """ > > > Builds HTML output to be passed to the index mako template, which > > > will be > > > > > > @@ -122,7 +131,7 @@ class HTMLIndex(list): > > > # Split the group names and test names, then determine > > > # which groups to close and which to open > > > > > > - openList = key.split('/') > > > + openList = key.replace('\\', '/').split('/') > > > > > > test = openList.pop() > > > openList, closeList = returnList(openList, list(currentDir)) > > > > > > @@ -172,6 +181,8 @@ class HTMLIndex(list): > > > except KeyError: > > > href = key > > > > > > + href = escapeFilename(href) > > > + > > > > > > try: > > > self._testResult(each.name, href, > > > > > > summary.status[each.name][key]) > > > > > > @@ -454,7 +465,8 @@ class Summary: > > > # Then build the individual test results > > > > > > for key, value in each.tests.iteritems(): > > > - temp_path = path.join(destination, each.name, > > > path.dirname(key)) + html_path = path.join(destination, > > > each.name, escapeFilename(key + ".html")) + temp_path = > > > path.dirname(html_path) > > > > > > if value['result'] not in exclude: > > > # os.makedirs is very annoying, it throws an OSError > > > if > > > > > > @@ -469,8 +481,7 @@ class Summary: > > > if value.get('time') is not None: > > > value['time'] = datetime.timedelta(0, > > > value['time']) > > > > > > - with open(path.join(destination, each.name, key + > > > ".html"), - 'w') as out: > > > > > + with open(path.join(html_path), 'w') as out: > > Does path.join do anything useful here? > > > > > out.write(testfile.render( > > > > > > testname=key, > > > value=value, > > > > > > -- > > > 1.9.1 > > > > > > _______________________________________________ > > > 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=pq%2BpK1vkXCqlaqJivIYzQtk5jZOW2unZKo0BPGzfgvI%3D%0A&s=bc29656ca62550f3a1d5e34ddd5a4bc9c1054f74f56792e2206121ece9ef3c5f > > > > _______________________________________________ > > 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=pq%2BpK1vkXCqlaqJivIYzQtk5jZOW2unZKo0BPGzfgvI%3D%0A&s=bc29656ca62550f3a1d5e34ddd5a4bc9c1054f74f56792e2206121ece9ef3c5f > _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
