From 0803124c148a492c4ab5f874ea9c74afb300376a Mon Sep 17 00:00:00 2001 From: kitoy Date: Sun, 21 Dec 2025 19:31:39 +0100 Subject: [PATCH] Modify utils log code for more clarity --- tools/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/utils.py b/tools/utils.py index ff524e9..c90d585 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -27,10 +27,12 @@ def login_required(f): def append_to_log(log_line, user): + tmp="" log_file=os.path.join(DOSSIER_PERSO, user, "log.txt") - logs=open(log_file, "r") - tmp=logs.read() - logs.close() + if os.path.exists(log_file): + logs=open(log_file, "r") + tmp=logs.read() + logs.close() log=open(log_file, "w") log.write(log_line) log.write(tmp)