Skip to content

Commit

Permalink
Fix issue #462
Browse files Browse the repository at this point in the history
  • Loading branch information
alvra authored and gijzelaerr committed Mar 12, 2022
1 parent e20c0da commit d0afe21
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eduvpn/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def _set_setting(what: str, value: str):

def serialize_datetime(dt: datetime) -> str:
assert dt.tzinfo is not None
if not hasattr(datetime, 'fromisoformat'):
# Python < 3.7.
dt = dt.astimezone(timezone.utc)
return dt.isoformat()


Expand All @@ -102,6 +105,9 @@ def deserialize_datetime(value: str) -> datetime:
format += '.%f'
if '+' in value or value.count('-') > 2:
format += '%z'
if value[-3] == ':':
# Fix issue #462; Python3.6 does not accept the colon (bpo-31800).
value = value[:-3] + value[-2:]
dt = datetime.strptime(value, format)
# NOTE: Older versions stored session validities
# as they appeared on the certificate; without a timezone.
Expand Down

0 comments on commit d0afe21

Please sign in to comment.