From de644c6630470d3cda91feb365a88668ad4e0192 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sun, 18 Jan 2015 10:58:54 +0100 Subject: reproducible: _html_notes: allow issues with 0 affected packages --- bin/reproducible_html_notes.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py index 3c5f1356..48310da8 100755 --- a/bin/reproducible_html_notes.py +++ b/bin/reproducible_html_notes.py @@ -290,18 +290,27 @@ def iterate_over_issues(issues): log.info("you can now see the issue at " + desturl) i = i + 1 +def sort_issues(issue): + try: + return (-len(issues_count[issue]), issue) + except KeyError: # there are no packages affected by this issue + return (0, issue) + def index_issues(issues): templ = "\n\n" + tab + "\n" + tab*2 + "\n" + tab*2 + "\n" + tab + "\n" html = (tab*2).join(templ.splitlines(True)) - for issue in sorted(issues, key=lambda x: (-len(issues_count[x]), x)): + for issue in sorted(issues, key=sort_issues): html += tab*3 + '\n' html += tab*4 + '\n' html += tab*4 + '\n' html += tab*3 + '\n' html += tab*2 + '
\n" \ + tab*3 + "Identified issues\n" + tab*2 + "\n" \ + tab*3 + "Affected packages\n" + tab*2 + "
' + issue + '\n' - html += tab*5 + '' + str(len(issues_count[issue])) + ':\n' - html += tab*5 + ', '.join(issues_count[issue]) + '\n' + try: + html += tab*5 + '' + str(len(issues_count[issue])) + ':\n' + html += tab*5 + ', '.join(issues_count[issue]) + '\n' + except KeyError: # there are no packages affected by this issue + html += tab*5 + '0\n' html += tab*4 + '
\n' -- cgit v1.2.3-54-g00ecf