[Piglit] [PATCH 03/16] summary: Generate a new empty page for pages with no results
Dylan Baker
baker.dylan.c at gmail.com
Thu Jun 13 08:36:10 PDT 2013
This new page is able to convey the same information, but takes less
time to generate
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/summary.py | 21 ++++++++++++++++-----
templates/empty_status.mako | 27 +++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 5 deletions(-)
create mode 100644 templates/empty_status.mako
diff --git a/framework/summary.py b/framework/summary.py
index a2794d9..5d4fe57 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -756,6 +756,10 @@ class NewSummary:
output_encoding="utf-8",
module_directory=".makotmp")
+ empty_status = Template(filename="templates/empty_status.mako",
+ output_encoding="utf-8",
+ module_directory=".makotmp")
+
# A list of pages to be generated
# If there is only one set of results, then there cannot be changes,
# regressions or fixes, so don't generate those pages
@@ -778,9 +782,16 @@ class NewSummary:
# Generate the rest of the pages
for page in pages:
file = open(path.join(destination, page + '.html'), 'w')
- file.write(index.render(results=HTMLIndex(self, self.tests[page]),
- page=page,
- pages=pages,
- colnum=len(self.results),
- exclude=exclude))
+ # If there is information to display display it
+ if self.tests[page]:
+ file.write(index.render(results=HTMLIndex(self,
+ self.tests[page]),
+ pages=pages,
+ page=page,
+ colnum=len(self.results),
+ exclude=exclude))
+ # otherwise provide an empty page
+ else:
+ file.write(empty_status.render(page=page, pages=pages))
+
file.close()
diff --git a/templates/empty_status.mako b/templates/empty_status.mako
new file mode 100644
index 0000000..56a4b70
--- /dev/null
+++ b/templates/empty_status.mako
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Result summary</title>
+ <link rel="stylesheet" href="status.css" type="text/css" />
+ </head>
+ <body>
+ <h1>Result summary</h1>
+ <p>Currently showing: ${page}</p>
+ <p>Show:
+ ## Index is a logical choice to put first, it will always be a link
+ ## and we don't want in preceeded by a |
+ <a href="index.html">index</a>
+ % for i in pages:
+ % if i == page:
+ | ${i}
+ % else:
+ | <a href="${i}.html">${i}</a>
+ % endif
+ % endfor
+ </p>
+ <h1>This page is empty! Yay?</h1>
+ </body>
+</html>
--
1.8.1.4
More information about the Piglit
mailing list