← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~lgp171188/launchpad:uct-import-optional-date-none-fix into launchpad:master

 

Guruprasad has proposed merging ~lgp171188/launchpad:uct-import-optional-date-none-fix into launchpad:master.

Commit message:
Make the vulnerability dates timezone-aware only when they are not None

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/430134
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:uct-import-optional-date-none-fix into launchpad:master.
diff --git a/lib/lp/bugs/scripts/uct/uctimport.py b/lib/lp/bugs/scripts/uct/uctimport.py
index 87d6b0d..3bcdf0b 100644
--- a/lib/lp/bugs/scripts/uct/uctimport.py
+++ b/lib/lp/bugs/scripts/uct/uctimport.py
@@ -328,15 +328,18 @@ class UCTImporter:
         :param cve: `CVE` with information from UCT
         """
         date_made_public = cve.date_made_public
-        if date_made_public.tzinfo is None:
+        if date_made_public and date_made_public.tzinfo is None:
             date_made_public = date_made_public.replace(tzinfo=timezone.utc)
         date_notice_issued = cve.date_notice_issued
-        if date_notice_issued.tzinfo is None:
+        if date_notice_issued and date_notice_issued.tzinfo is None:
             date_notice_issued = date_notice_issued.replace(
                 tzinfo=timezone.utc
             )
         date_coordinated_release = cve.date_coordinated_release
-        if date_coordinated_release.tzinfo is None:
+        if (
+            date_coordinated_release
+            and date_coordinated_release.tzinfo is None
+        ):
             date_coordinated_release = date_coordinated_release.replace(
                 tzinfo=timezone.utc
             )