From 679885d7b4c5e0c60b9ae3f09ea1ef6fc654111b Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Mon, 16 Feb 2015 23:17:59 +0100 Subject: reproducible: html_indexes: catch ZeroDivisionError while calculating percentage --- bin/reproducible_html_indexes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/reproducible_html_indexes.py b/bin/reproducible_html_indexes.py index 9847781a..a0f18fab 100755 --- a/bin/reproducible_html_indexes.py +++ b/bin/reproducible_html_indexes.py @@ -240,8 +240,13 @@ pages = { def build_leading_text_section(section, rows): html = '

\n' + tab total = len(rows) - percent = round(((total/count_total)*100), 1) # count_total is - try: # defined in common + try: + percent = round(((total/count_total)*100), 1) # count_total is + except ZeroDivisionError: # defined in common + log.error('Looks like there are either no tested package or no ' + \ + 'packages available at all. Maybe it\'s a new database?') + percent = 0.0 + try: html += '' no_icon_link = False except KeyError: -- cgit v1.2.3-70-g09d2