diff --git a/app/scodoc/sco_users.py b/app/scodoc/sco_users.py
index d08e7602f..d31c08380 100644
--- a/app/scodoc/sco_users.py
+++ b/app/scodoc/sco_users.py
@@ -343,8 +343,12 @@ def user_info(user_name_or_id=None, user: User = None):
info = None
user_name = "inconnu"
else:
- info = user.to_dict()
- user_name = user.user_name
+ if user is None: # utilisateur supprimé (rare)
+ user_name = "inconnu !"
+ info = None
+ else:
+ info = user.to_dict()
+ user_name = user.user_name
if not info:
# special case: user is not in our database
@@ -365,11 +369,10 @@ def user_info(user_name_or_id=None, user: User = None):
"status": "",
"date_expiration": None,
}
- else:
- # Ensure we never publish password hash
- if "password_hash" in info:
- del info["password_hash"]
- return info
+ # Ensure we never publish password hash
+ if "password_hash" in info:
+ del info["password_hash"]
+ return info
MSG_OPT = """
Attention: (vous pouvez forcer l'opération en cochant "Ignorer les avertissements" en bas de page)"""