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

Proposed by Guruprasad
Status: Merged
Approved by: Guruprasad
Approved revision: f090d88b4005d433c814ae38d9063422e9a452d7
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~lgp171188/launchpad:uct-import-optional-date-none-fix
Merge into: launchpad:master
Diff against target: 26 lines (+6/-3)
1 file modified
lib/lp/bugs/scripts/uct/uctimport.py (+6/-3)
Reviewer Review Type Date Requested Status
Andrey Fedoseev (community) Approve
Review via email: mp+430134@code.launchpad.net

Commit message

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

To post a comment you must log in.
Revision history for this message
Andrey Fedoseev (andrey-fedoseev) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/bugs/scripts/uct/uctimport.py b/lib/lp/bugs/scripts/uct/uctimport.py
2index 87d6b0d..3bcdf0b 100644
3--- a/lib/lp/bugs/scripts/uct/uctimport.py
4+++ b/lib/lp/bugs/scripts/uct/uctimport.py
5@@ -328,15 +328,18 @@ class UCTImporter:
6 :param cve: `CVE` with information from UCT
7 """
8 date_made_public = cve.date_made_public
9- if date_made_public.tzinfo is None:
10+ if date_made_public and date_made_public.tzinfo is None:
11 date_made_public = date_made_public.replace(tzinfo=timezone.utc)
12 date_notice_issued = cve.date_notice_issued
13- if date_notice_issued.tzinfo is None:
14+ if date_notice_issued and date_notice_issued.tzinfo is None:
15 date_notice_issued = date_notice_issued.replace(
16 tzinfo=timezone.utc
17 )
18 date_coordinated_release = cve.date_coordinated_release
19- if date_coordinated_release.tzinfo is None:
20+ if (
21+ date_coordinated_release
22+ and date_coordinated_release.tzinfo is None
23+ ):
24 date_coordinated_release = date_coordinated_release.replace(
25 tzinfo=timezone.utc
26 )

Subscribers

People subscribed via source and target branches

to status/vote changes: