diff --git a/app/processors/stats.py b/app/processors/stats.py index 0a2c893..cb1ed26 100644 --- a/app/processors/stats.py +++ b/app/processors/stats.py @@ -5,4 +5,4 @@ from app import app @app.before_request def request_time(): g.request_start_time = time() - g.request_time = lambda: "%.5fs" % (time() - g.request_start_time) + g.request_time = lambda: time() - g.request_start_time diff --git a/app/static/css/header.css b/app/static/css/header.css index a75f8b4..fbeaf70 100644 --- a/app/static/css/header.css +++ b/app/static/css/header.css @@ -85,3 +85,15 @@ header .form input[type="search"]:focus ~ a { #spotlight a { display: block; } + + +#server-speed-warning { + background: var(--warn); + color: var(--warn-text); + text-align: center; + border-radius: 2px; + padding: 4px; + margin: 0 8px; + font-weight: bold; + text-shadow: 0 1px 1px rgba(0,0,0,.5); +} diff --git a/app/templates/base/footer.html b/app/templates/base/footer.html index aa30d5a..8f09472 100644 --- a/app/templates/base/footer.html +++ b/app/templates/base/footer.html @@ -2,7 +2,7 @@
Planète Casio est un site communautaire non affilié à CASIO. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou des copyrights.
{% if current_user.is_authenticated and current_user.priv('misc.dev-infos') %} -Page générée en {{ g.request_time() }}
+Page générée en {{ "%.3f" % g.request_time() }} secondes.
{% endif %}Ceci est un environnement de test. Tout contenu peut être supprimé sans avertissement préalable.
diff --git a/app/templates/base/header.html b/app/templates/base/header.html index 46d25a0..932bae6 100644 --- a/app/templates/base/header.html +++ b/app/templates/base/header.html @@ -11,3 +11,10 @@ + +{% if current_user.is_authenticated and current_user.priv('misc.dev-infos') %} + {% set reqtime = g.request_time() %} + {% if reqtime > V5Config.SLOW_REQUEST_THRESHOLD %} +