From 9c51deed480b2c1d95bb00997b2fb4523f8fa22c Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 22 Aug 2021 07:47:41 +0200 Subject: [PATCH] fix date_expiration --- app/views/users.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/users.py b/app/views/users.py index 1d6a0f707..01c30277d 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -397,9 +397,12 @@ def create_user_form(REQUEST, user_name=None, edit=0): del vals["status"] # no one can't change its own status if "date_expiration" in vals: try: - vals["date_expiration"] = datetime.datetime.strptime( - vals["date_expiration"], "%d/%m/%Y" - ) + if vals["date_expiration"]: + vals["date_expiration"] = datetime.datetime.strptime( + vals["date_expiration"], "%d/%m/%Y" + ) + else: + vals["date_expiration"] = None except ValueError: H.append(tf_error_message("date expiration invalide")) return "\n".join(H) + "\n" + tf[1] + F