[Git][security-tracker-team/security-tracker][master] 6 commits: update-nvd: convert values to a list

Emilio Pozuelo Monfort pochu at debian.org
Thu Aug 6 10:03:04 BST 2020



Emilio Pozuelo Monfort pushed to branch master at Debian Security Tracker / security-tracker


Commits:
78ea9207 by Emilio Pozuelo Monfort at 2020-08-06T11:02:28+02:00
update-nvd: convert values to a list

Otherwise we get a dict_values object under python3 which we
can't sort.

- - - - -
e04e5284 by Emilio Pozuelo Monfort at 2020-08-06T11:02:28+02:00
update-nvd: switch to Python 3

- - - - -
1845f029 by Emilio Pozuelo Monfort at 2020-08-06T11:02:28+02:00
apt-update-file: switch to Python 3

- - - - -
ff2f0a7a by Emilio Pozuelo Monfort at 2020-08-06T11:02:28+02:00
tracker_service: convert maps to lists for make_list

Otherwise under python 3, make_list will fail with empty maps
as the map object will evaluate to true even if it's empty.

We could cast to a list in make_list before evaluating it, but
then we would need to ensure that we're receiving a valid type.
This is probably simpler.

- - - - -
3aca49fd by Emilio Pozuelo Monfort at 2020-08-06T11:02:28+02:00
web_support: make_list requires a list argument

- - - - -
11bf1e8a by Emilio Pozuelo Monfort at 2020-08-06T11:02:28+02:00
tracker_service: switch to Python 3

- - - - -


4 changed files:

- bin/apt-update-file
- bin/tracker_service.py
- bin/update-nvd
- lib/python/web_support.py


Changes:

=====================================
bin/apt-update-file
=====================================
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # This script is mainly used to demo the updateFile function.
 from __future__ import print_function


=====================================
bin/tracker_service.py
=====================================
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 import sys
 sys.path.insert(0,'../lib/python')
@@ -519,7 +519,7 @@ data source.""")],
                     bugs = n.bugs
                     bugs.sort()
                     bugs = make_list(
-                        map(lambda x: self.make_debian_bug(url, x), bugs))
+                        list(map(lambda x: self.make_debian_bug(url, x), bugs)))
                     if n.bug_origin:
                         origin = self.make_xref(url, n.bug_origin)
                     else:
@@ -1593,12 +1593,12 @@ Debian bug number.'''),
         return A(url.scriptRelative(name), name)
 
     def make_xref_list(self, url, lst, separator=', '):
-        return make_list(map(lambda x: self.make_xref(url, x), lst), separator)
+        return make_list(list(map(lambda x: self.make_xref(url, x), lst)), separator)
 
     def make_debian_bug(self, url, debian):
         return A(self.url_debian_bug(url, debian), str(debian))
     def make_debian_bug_list(self, url, lst):
-        return make_list(map(lambda x: self.make_debian_bug(url, x), lst))
+        return make_list(list(map(lambda x: self.make_debian_bug(url, x), lst)))
 
     def make_cve_ref(self, url, cve, name=None):
         if name is None:


=====================================
bin/update-nvd
=====================================
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 import os
 import os.path
@@ -39,7 +39,7 @@ for name in sys.argv[1:]:
 deduplicate = {}
 for x in data:
     deduplicate[x[0]] = x
-data = deduplicate.values()
+data = list(deduplicate.values())
 data.sort()
 
 cursor = db.writeTxn()


=====================================
lib/python/web_support.py
=====================================
@@ -524,7 +524,7 @@ def make_numbered_list(entries):
 
 def make_list(lst, separator=", "):
     """Creates a list of HTML elements."""
-    assert not isstring(lst)
+    assert isinstance(lst, list)
     c = []
     if lst:
         for e in lst:



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/e8be4894b59ab4f265d4c70800ee7ea8ca0a7dc6...11bf1e8a561f32dfc4bee05837403321a0fd0428

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/e8be4894b59ab4f265d4c70800ee7ea8ca0a7dc6...11bf1e8a561f32dfc4bee05837403321a0fd0428
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-security-tracker-commits/attachments/20200806/f3c73f68/attachment-0001.html>


More information about the debian-security-tracker-commits mailing list