+
+''')
+
print(' ')
-for domain, count in c.execute(domain_count_query).fetchall():
+for domain, count in ordered_domains:
print('
%s (%d bugs)
' % (domain, domain_map[domain], count))
- for system, count in c.execute(("SELECT system, COUNT(*) FROM bugs WHERE domain = '%s' AND " + common_where_clause + " GROUP BY system ORDER BY COUNT(*) DESC") % (domain,)).fetchall():
- print('
%s (%d bugs)
' % (system, count))
- for title, url, found_by, resolution in c.execute(("SELECT title, url, reported_by, resolution FROM bugs WHERE domain='%s' AND system='%s' AND " + common_where_clause + ";") % (domain, system)).fetchall():
- print('')
- print('%s'% (title, ))
+ domain_bugs = [entry for entry in included_bugs if entry.get('domain') == domain]
+ system_counts = Counter(entry.get('system') for entry in domain_bugs)
+ ordered_systems = sorted(system_counts.items(), key=lambda item: item[1], reverse=True)
+ for system, count in ordered_systems:
+ print('')
+ print('%s (%d bugs)' % (escape(system or 'Unknown database'), count))
+ for entry in domain_bugs:
+ if entry.get('system') != system:
+ continue
+ title = entry.get('title')
+ url = entry.get('url')
+ found_by = entry.get('reported_by')
+ resolution = entry.get('resolution')
+ print('')
+ print('%s' % escape(title or 'Untitled bug'))
if resolution is None:
resolution = 'unconfirmed'
- print('Status: %s ' % (resolution, ))
- print('Link: %s ' % (url, url))
- print('Found by: %s' % (found_by,))
+ safe_url = escape(url or '', quote=True)
+ print('Status: %s ' % escape(resolution))
+ print('Link: %s ' % (safe_url, escape(url or '')))
+ print('Found by: %s' % escape(found_by or 'Unknown'))
print('')
+ print('')
+
+print('''
+''')