[Secure-testing-commits] r28963 - bin

Holger Levsen holger at moszumanska.debian.org
Mon Sep 22 21:53:47 UTC 2014


Author: holger
Date: 2014-09-22 21:53:47 +0000 (Mon, 22 Sep 2014)
New Revision: 28963

Modified:
   bin/tracker_service.py
Log:
switch to radio buttons for release overview views.

Modified: bin/tracker_service.py
===================================================================
--- bin/tracker_service.py	2014-09-22 19:58:35 UTC (rev 28962)
+++ bin/tracker_service.py	2014-09-22 21:53:47 UTC (rev 28963)
@@ -24,66 +24,69 @@
     webservice_base_class = WebServiceHTTP
 
 class BugFilter:
-    default_action_list = [('show_high_urgency', 'only high urgencies'),
-                           ('show_medium_urgency', 'only medium and high urgencies'),
-                           ('show_undetermined_urgency', 'issues that may be vulnerable but need to be checked (shown in purple)'),
-                           ('show_unimportant_urgency', 'unimportant issues'),
-                           ('show_remote_only', 'only remote vulnerabilities')]
-    def __init__(self, params, action_list=None):
-        if action_list is None:
-            self.action_list = self.default_action_list
-        else:
-            self.action_list = action_list
+    default_action_list = [('high_urgency', 'high', 'urgency'),
+                           ('medium_urgency', 'medium', 'urgency'),
+                           ('low_urgency', 'low', 'urgency'),
+                           ('unimportant_urgency', 'unimportant', 'urgency'),
+                           ('unassigned_urgency', 'not_yet_assigned', 'urgency'),
+
+                           ('remote', 'hide remote scope', 'scope'),
+                           ('local', 'hide local scope', 'scope'),
+                           ('unclear', 'hide unclear scope', 'scope'),
+
+                           ('undetermined_issues', 'extra: needs to be checked (will be shown in purple)', 'extra'),]
+
+    def __init__(self, params, nonodsa=False):
+        self.action_list = self.default_action_list
+        if not nonodsa:
+            self.action_list = self.default_action_list +  [('nodsa', 'extra: noDSA', 'extra')]
         self.params = {}
-        for (prop, desc) in self.action_list:
+        for (prop, desc, field) in self.action_list:
             self.params[prop] = int(params.get(prop, (0,))[0])
+        self.filters=params.get('filter')
+        if not self.filters:
+            self.filters=['high_urgency', 'medium_urgency', 'low_urgency']
 
     def actions(self, url):
         """Returns a HTML snippet which can be used to change the filter."""
 
         l = []
-        for (prop, desc) in self.action_list:
-            if self.params[prop]:
-                if self.params['show_medium_urgency'] and prop == 'show_medium_urgency':
-                    note = 'Restore lower than medium urgencies'
-                elif self.params['show_high_urgency'] and prop == 'show_high_urgency':
-                    note = 'Restore lower than high urgencies'
-                elif self.params['show_remote_only'] and prop == 'show_remote_only':
-                    note = 'Restore local vulnerabilities'
-                else:
-                    note = 'Hide ' + desc
-                l.append(LI(A(url.updateParamsDict({prop : None}), note)))
+        l.append(INPUT(type='hidden', name='filter', value='1'))
+        for (prop, desc, field) in self.action_list:
+            if prop in self.filters:
+                l.append(INPUT(desc, rel=field, type='checkbox', name='filter', value=prop, checked='checked'))
+                self.params[prop]=1
             else:
-                note = 'Show ' + desc
-                l.append(LI(A(url.updateParamsDict({prop : '1'}), note)))
+                l.append(INPUT(desc, rel=field, type='checkbox', name='filter', value=prop))
 
-        return UL(l)
+        return FORM(tag("span",l),
+                    INPUT(type='submit', value='Apply'),
+                    method='get')
 
     def urgencyFiltered(self, urg, vuln):
         """Returns True for urgencies that should be filtered."""
-        filterlow = self.params['show_medium_urgency'] and \
-                    urg in ('low', 'low**', 'unimportant',
-                    'undetermined', 'not yet assigned')
-        filtermed = self.params['show_high_urgency'] and \
-                    urg in ('medium', 'medium**', 'low', 'low**',
-                    'unimportant', 'undetermined', 'not yet assigned')
-        filterund = not self.params['show_undetermined_urgency'] and vuln == 2
-        filteruni = not self.params['show_unimportant_urgency'] \
+        filterlow = not self.params['low_urgency'] and \
+                    urg in ('low', 'low**')
+        filtermed = not self.params['medium_urgency'] and \
+                    urg in ('medium', 'medium**')
+        filterhigh = not self.params['high_urgency'] and \
+                    urg in ('high', 'high**')
+        filterund = not self.params['undetermined_issues'] and vuln == 2
+        filteruni = not self.params['unimportant_urgency'] \
                     and urg == 'unimportant'
-        return filterlow or filtermed or filterund or filteruni
+        filteruna = not self.params['unassigned_urgency'] \
+                    and urg ==  'not yet assigned'
+        return filterlow or filtermed or filterhigh or filterund or filteruni or filteruna
 
     def remoteFiltered(self, remote):
-        """Returns True for only remote flaws if filtered."""
-        return self.params['show_remote_only'] and not remote and not remote is None
+	filterr = self.params['remote'] and remote and remote is not None
+	filterl = self.params['local'] and not remote and remote is not None
+	filteru = self.params['unclear'] and remote is None
+	return filterr or filterl or filteru
 
-class BugFilterNoDSA(BugFilter):
-    def __init__(self, params):
-        BugFilter.__init__(self, params, self.default_action_list
-            + [('show_nodsa', 'issues that are not severe enough to warrant a DSA')])
-
     def nodsaFiltered(self, nodsa):
         """Returns True for no DSA issues if filtered."""
-        return nodsa and not self.params['show_nodsa']
+        return nodsa and not self.params['nodsa']
 
 class TrackerService(webservice_base_class):
     head_contents = compose(
@@ -627,7 +630,7 @@
     def page_status_release_stable_oldstable(self, release, params, url):
         assert release in ('stable', 'oldstable')
 
-        bf = BugFilterNoDSA(params)
+        bf = BugFilter(params)
 
         def gen():
             old_pkg_name = ''
@@ -682,7 +685,7 @@
                                                          params, url)
 
     def page_status_release_testing(self, path, params, url):
-        bf = BugFilterNoDSA(params)
+        bf = BugFilter(params)
 
         def gen():
             old_pkg_name = ''
@@ -738,8 +741,8 @@
              self.nvd_text])
 
     def page_status_release_unstable_like(self, path, params, url,
-                                          rel, title):
-        bf = BugFilter(params)
+                                          rel, subrel, title):
+        bf = BugFilter(params,nonodsa=True)
 
         def gen():
             old_pkg_name = ''
@@ -811,7 +814,7 @@
             rel='squeeze-backports')
 
     def page_status_dtsa_candidates(self, path, params, url):
-        bf = BugFilter(params)
+        bf = BugFilter(params,nonodsa=True)
 
         def gen():
             old_pkg_name = ''




More information about the Secure-testing-commits mailing list