From 92856ad31fd5d28892d9072dd1633a0b31976708 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Mon, 16 Oct 2023 11:31:09 -0400 Subject: [PATCH] fix: handle last_login date of null (#14756) --- warehouse/email/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/warehouse/email/__init__.py b/warehouse/email/__init__.py index 09201cf33e27..a0cb5f182b30 100644 --- a/warehouse/email/__init__.py +++ b/warehouse/email/__init__.py @@ -274,11 +274,11 @@ def send_password_reset_email(request, user_and_email): { "action": "password-reset", "user.id": str(user.id), - "user.last_login": str(user.last_login), + "user.last_login": str( + user.last_login or datetime.datetime.min.replace(tzinfo=pytz.UTC) + ), "user.password_date": str( - user.password_date - if user.password_date is not None - else datetime.datetime.min.replace(tzinfo=pytz.UTC) + user.password_date or datetime.datetime.min.replace(tzinfo=pytz.UTC) ), } )