From 8872673b6c2eebe389b93bd7bc6599f96a08236d Mon Sep 17 00:00:00 2001 From: Phuoc Cao Date: Thu, 30 Nov 2023 18:38:09 +0100 Subject: [PATCH] trier liste historique par date --- html_cleanup/static/temp/clean_www.icloud.com.html | 5 +++++ html_cleanup/static/temp/errors_log | 1 + html_cleanup/views/default.py | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 html_cleanup/static/temp/clean_www.icloud.com.html diff --git a/html_cleanup/static/temp/clean_www.icloud.com.html b/html_cleanup/static/temp/clean_www.icloud.com.html new file mode 100644 index 0000000..23b4f73 --- /dev/null +++ b/html_cleanup/static/temp/clean_www.icloud.com.html @@ -0,0 +1,5 @@ + + + +untitled + diff --git a/html_cleanup/static/temp/errors_log b/html_cleanup/static/temp/errors_log index a3d959e..dc65b8c 100644 --- a/html_cleanup/static/temp/errors_log +++ b/html_cleanup/static/temp/errors_log @@ -1,3 +1,4 @@ 2023-11-29 17:22:16 [ Nantes_anthologie_cinema_viet.htm ] *** Cleanup réussi. *** 2023-11-29 17:23:56 [ Screenshot 2023-11-20 at 12.07.54.png ] Le format du fichier n'est pas valide. Téléchargement refusé. 30-11-2023 17:29 [ Nantes_anthologie_cinema_viet.htm ] *** Cleanup réussi. *** +30-11-2023 18:32 [ www.icloud.com.html ] *** Cleanup réussi. *** diff --git a/html_cleanup/views/default.py b/html_cleanup/views/default.py index 7ca2db3..a5b051f 100644 --- a/html_cleanup/views/default.py +++ b/html_cleanup/views/default.py @@ -191,8 +191,11 @@ def view_log(request): except Exception as e: pass - # lire tous les fichiers du dossier - for f in os.scandir(temp_folder): + # lire tous les fichiers du dossier triés par date + entries = sorted(os.scandir(temp_folder), key=lambda ent: ent.stat().st_mtime) + + # parcorrir tous les fichiers du dossier + for f in entries: if f.name[0] != '.' and f.name != 'errors_log': f_path = temp_folder + f.name nbs = os.path.getmtime(f_path) # en nombre de secondes