From d0f0ac0c1edd26de8dfecd5f2081afacb52ba7f6 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Apr 12 2016 06:45:14 +0000 Subject: more HTML twiddling, now it's spec compliant... ...and slightly better looking. and shorter. --- diff --git a/fedora_nightlies.py b/fedora_nightlies.py index 94c3ade..8182393 100755 --- a/fedora_nightlies.py +++ b/fedora_nightlies.py @@ -19,18 +19,23 @@ CURRENT_RELEASES = [] # HTML template HTML_TEMPLATE = """ - + + Fedora nightly compose finder -

Fedora nightly compose finder

-

This page helps you locate recent Fedora nightly composes. For each Fedora image, you can find the latest Branched and Rawhide nightly composes that completed. For images tested by openQA, you can also find the latest image for which all image-specific tests passed. This is not as strong an indication of quality as official Alpha or Beta status, but at least indicates that the image successfully boots, completes a system installation, and boots to the installed system, in a straightforward virtual machine configuration. These images are NOT official Fedora pre-releases. For assistance, contact #fedora-qa on Freenode IRC or the test@ mailing list.

-

- {TABLES} -

-

Updated at: {DATE} (UTC)

+

Fedora nightly compose finder

+

This page helps you locate recent Fedora nightly composes. For each Fedora image, you can find the latest Branched and Rawhide nightly composes that completed. For images tested by openQA, you can also find the latest image for which all image-specific tests passed. This is not as strong an indication of quality as official Alpha or Beta status, but at least indicates that the image successfully boots, completes a system installation, and boots to the installed system, in a straightforward virtual machine configuration. These images are NOT official Fedora pre-releases. For assistance, contact #fedora-qa on Freenode IRC or the test@ mailing list.

+ +{{ROWS}} +
+

Updated at: {{DATE}} (UTC)

""" @@ -368,17 +373,19 @@ class Nightlies(object): better soon, but it does the job for now. """ - def _group_table(group): - """Produce the HTML table for a group.""" + def _group_rows(group): + """Produce the HTML table rows for a group.""" (built, passed) = self.get_latests(group) # start a table for the image group. - table = "

\n\n" - table += "\n\n".format(group) - for rel in built: + table = "\n\n\n".format(group) + # add the column titles row + table += "\n" + table += "\n\n" + for (num, rel) in enumerate(built): # add another header line for the release name. - table += "\n\n\n".format(rel) - # add the column titles header row. - table += "\n\n\n" + table += "\n\n\n".format(rel) for arch in built[rel]: cid = built[rel][arch]['compose'] url = built[rel][arch]['url'] @@ -394,8 +401,6 @@ class Nightlies(object): table += "\n" # in either case, close out the row. table += "\n" - # close out table and paragraph. - table += "
{0}
" + table += "{0}
ArchLast builtLast known good
{0}
ArchLast builtLast known good
" + table += "Fedora {0}
\n

" return table # find all image groups and sort by weight @@ -404,10 +409,11 @@ class Nightlies(object): if img.group not in groups: groups[img.group] = {'score': fedfind.helpers.get_weight(img)} groups = sorted(groups.keys(), key=lambda x: groups[x], reverse=True) - # get the HTML for the image group tables - tables = "\n".join([_group_table(group) for group in groups]) + # get the HTML for the image group rows + rows = "\n".join([_group_rows(group) for group in groups]) # read in the template and sub out the tables and the time - html = HTML_TEMPLATE.format(TABLES=tables, DATE=str(datetime.datetime.utcnow())) + html = HTML_TEMPLATE.replace('{{ROWS}}', rows) + html = html.replace('{{DATE}}', str(datetime.datetime.utcnow())) with open(self.htmlfile, 'w') as htmlfh: htmlfh.write(html)