Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
further date parsing corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Lechte authored and djrobstep committed Oct 14, 2016
1 parent e24d0ff commit 9969151
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dmutils/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from flask._compat import string_types

from datetime import datetime
import pendulum
from cryptography.fernet import Fernet, InvalidToken

from .formats import DATETIME_FORMAT
Expand Down Expand Up @@ -141,9 +142,8 @@ def decode_password_reset_token(token, data_api_client):
return {'error': 'token_invalid'}

user = data_api_client.get_user(decoded["user"])
user_last_changed_password_at = datetime.strptime(
user['users']['passwordChangedAt'],
DATETIME_FORMAT
user_last_changed_password_at = pendulum.parse(
user['users']['passwordChangedAt']
)

if timestamp < user_last_changed_password_at:
Expand Down
3 changes: 2 additions & 1 deletion dmutils/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import hashlib
import base64
import pytz
import pendulum

from dmutils.formats import DATETIME_FORMAT

Expand Down Expand Up @@ -82,7 +83,7 @@ def from_json(user_json):
user = user_json["users"]
supplier_code = None
supplier_name = None
terms_accepted_at = datetime.strptime(user['termsAcceptedAt'], DATETIME_FORMAT)
terms_accepted_at = pendulum.parse(user['termsAcceptedAt'])
terms_accepted_at = terms_accepted_at.replace(tzinfo=pytz.timezone('UTC'))
if "supplier" in user:
supplier_code = user["supplier"]["supplierCode"]
Expand Down

0 comments on commit 9969151

Please sign in to comment.