[Secure-testing-commits] r28835 - bin lib/python

Holger Levsen holger at moszumanska.debian.org
Tue Sep 16 19:22:32 UTC 2014


Author: holger
Date: 2014-09-16 19:22:32 +0000 (Tue, 16 Sep 2014)
New Revision: 28835

Modified:
   bin/tracker_service.py
   lib/python/web_support.py
Log:
web view: move H2 generation into make_table(), so empty tables won't
have a headline.

Modified: bin/tracker_service.py
===================================================================
--- bin/tracker_service.py	2014-09-16 18:39:09 UTC (rev 28834)
+++ bin/tracker_service.py	2014-09-16 19:22:32 UTC (rev 28835)
@@ -386,7 +386,6 @@
         page.append(make_table(gen_header()))
 
         if bug.notes:
-            page.append(H2("Vulnerable and fixed packages"))
 
             def gen_source():
                 old_pkg = ''
@@ -411,8 +410,9 @@
                     yield package, ', '.join(release), version, vuln
 
             page.append(make_table(gen_source(),
-    caption=("Source Package", "Release", "Version", "Status"),
-    introduction=P('The table below lists information on source packages.')))
+                title=H2('Vulnerable and fixed packages'),
+                caption=("Source Package", "Release", "Version", "Status"),
+                introduction=P('The table below lists information on source packages.')))
 
             def gen_data():
                 notes_sorted = bug.notes[:]
@@ -592,41 +592,40 @@
                         pkg + ' in the Bug Tracking System'),
                        (self.url_testing_status(url, pkg),
                         pkg + ' in the testing migration checker')),
-             H2('Available versions'),
-             make_table(gen_versions(), caption=('Release', 'Version')),
+             make_table(gen_versions(), title=H2('Available versions'), caption=('Release', 'Version')),
 
-             H2('Open issues'),
              make_table(
                  gen_summary(
                      # open issues
                      self.db.getBugsForSourcePackage(
                          self.db.cursor(), pkg, True, False),
                  ),
+                 title=H2('Open issues'),
                  caption=('Bug',) + suites + ('Description',),
                  replacement='No known open issues.'
              ),
 
 
-             H2('Open unimportant issues'),
              make_table(
                  gen_summary(
                      # open unimportant isues
                      self.db.getBugsForSourcePackage(
                          self.db.cursor(), pkg, True, True),
                  ),
+                 title=H2('Open unimportant issues'),
                  caption=('Bug',) + suites + ('Description',),
                  replacement='No known unimportant issues.'
              ),
 
-             H2('Resolved issues'),
              make_table(gen_bug_list(self.db.getBugsForSourcePackage
                                      (self.db.cursor(), pkg, False, True)),
+                        title=H2('Resolved issues'),
                         caption=('Bug', 'Description'),
                         replacement='No known resolved issues.'),
 
-             H2('Security announcements'),
              make_table(gen_bug_list(self.db.getDSAsForSourcePackage
                                      (self.db.cursor(), pkg)),
+                        title=H2('Security announcements'),
                         caption=('DSA / DLA', 'Description'),
                         replacement='No known security announcements.')
              ])
@@ -1181,8 +1180,8 @@
 In the second kind of names, there is a Debian bug for the issue, and the "''',
                CODE("000000"), '''"part of the name is replaced with the
 Debian bug number.'''),
-             H2("With unfixed issues"), make_table(gen(1), caption=("Bug", "Description")),
-             H2("The rest"), make_table(gen(0), caption=("Bug", "Description")),
+             make_table(gen(1),title=H2('With unfixed issues'), caption=("Bug", "Description")),
+             make_table(gen(0),title=H2('The rest'), caption=("Bug", "Description")),
             ])
 
     def page_data_pts(self, path, params, url):

Modified: lib/python/web_support.py
===================================================================
--- lib/python/web_support.py	2014-09-16 18:39:09 UTC (rev 28834)
+++ lib/python/web_support.py	2014-09-16 19:22:32 UTC (rev 28835)
@@ -443,7 +443,7 @@
     contents = re.sub(r'(httpS?://[\w.-]+/.*?)([,\s]|$)', _linkify, contents)
     return contents
 
-def make_table(contents, caption=None, replacement=None, introduction=None):
+def make_table(contents, title=None, caption=None, replacement=None, introduction=None):
     rows = []
     for row in contents:
         cols = []
@@ -457,9 +457,11 @@
             cols.append(TD(col))
         rows.append(Tag('tr', cols))
     if rows:
-        if introduction:
-            return compose(introduction, TABLE(rows))
-        return TABLE(rows)
+	if not introduction:
+            introduction=''
+        if not title:
+            title=''
+        return compose(title, introduction, TABLE(rows))
     else:
         return compose()
 




More information about the Secure-testing-commits mailing list