From: Olivier Tétard Date: Mon, 16 Nov 2015 21:48:45 +0000 (+0100) Subject: Tri de la home page par date d’upload des fichiers X-Git-Url: http://olivier.miskin.fr/git/?a=commitdiff_plain;h=b4d4af0b226d110a6909d8e42b6be9149b140407;p=femtoblackweb.git Tri de la home page par date d’upload des fichiers --- diff --git a/femtoblackweb.py b/femtoblackweb.py index 10d7afa..1138e71 100644 --- a/femtoblackweb.py +++ b/femtoblackweb.py @@ -50,7 +50,7 @@ def index(): """ files = [] - for p in pathlib.Path(app.config['UPLOAD_FOLDER']).iterdir(): + for p in sorted(pathlib.Path(app.config['UPLOAD_FOLDER']).iterdir(), key=lambda x: x.stat().st_ctime, reverse=True): (filename, ext) = os.path.splitext(p.name) json_file = os.path.join(app.config['UPLOAD_FOLDER'], "{}.json".format(p.name))