Merge ~chad.smith/software-properties:ua-status-from-json-impish into software-properties:ubuntu/impish

Proposed by Chad Smith
Status: Merged
Merged at revision: def98e83b50cfb9be2354d0680a5f654ce043855
Proposed branch: ~chad.smith/software-properties:ua-status-from-json-impish
Merge into: software-properties:ubuntu/impish
Diff against target: 17 lines (+4/-1)
1 file modified
softwareproperties/gtk/SoftwarePropertiesGtk.py (+4/-1)
Reviewer Review Type Date Requested Status
Robert Ancell (community) Approve
Review via email: mp+411102@code.launchpad.net

Commit message

SoftwarePropertiesGTK: ignore timezone offsets of contract expiry

Avoid 'Unable to process contract expiry' messages

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/softwareproperties/gtk/SoftwarePropertiesGtk.py b/softwareproperties/gtk/SoftwarePropertiesGtk.py
2index e77e179..f7ccc93 100644
3--- a/softwareproperties/gtk/SoftwarePropertiesGtk.py
4+++ b/softwareproperties/gtk/SoftwarePropertiesGtk.py
5@@ -426,8 +426,11 @@ class SoftwarePropertiesGtk(SoftwareProperties, SimpleGtkbuilderApp):
6 # gives software properties dialogs a chance to interact about
7 # renewals if needed.
8 try:
9+ # Ignore timezone to simplify formatting python < 3.7
10+ # 3.7 has datetime.fromisoformat()
11+ dt, _sep, _tz = status.get("expires", "").partition("+")
12 eol_date = datetime.datetime.strptime(
13- status.get("expires"), "%Y-%m-%dT%H:%M:%S"
14+ dt, "%Y-%m-%dT%H:%M:%S"
15 ).date()
16 except ValueError:
17 print("Unable to determine UA contract expiry")

Subscribers

People subscribed via source and target branches