From 7d7f76ba33289c1ee75065f99160ded45ddef7f1 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sat, 31 Dec 2022 15:54:25 +1100 Subject: [PATCH] about page now extends base (so has navbar -oops), and DEV finds last file change time --- main.py | 10 +++++++++- templates/about.html | 29 +++-------------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/main.py b/main.py index 1e04d91..6d4d84e 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,8 @@ from flask_marshmallow import Marshmallow from flask_bootstrap import Bootstrap from wtforms import SubmitField, StringField, HiddenField, SelectField, IntegerField, TextAreaField, validators from flask_wtf import FlaskForm +import glob +from datetime import datetime import os import re import socket @@ -158,9 +160,15 @@ def about(): else: o['str']=o['str']+l except FileNotFoundError: + most_recent=0 + for file in glob.glob("./*"): + timestamp = os.path.getctime(file) + if timestamp < most_recent: + continue + most_recent = timestamp o={} o['date']="No known date" - o['str']='No commits to display (if this is DEV then last build is now)' + o['str']=f'No commits to display (if this is DEV then last change was {datetime.fromtimestamp(most_recent).replace(microsecond=0)})' # add last commit (or fake commit if no file) commits.append(o) diff --git a/templates/about.html b/templates/about.html index 2cf52de..633cbc2 100644 --- a/templates/about.html +++ b/templates/about.html @@ -1,27 +1,5 @@ - - - - -About Photo Assistant - - - - - - - - - - - - - - - - - - - +{% extends "base.html" %} +{% block main_content %}
@@ -44,5 +22,4 @@
- - +{% endblock main_content %}