From 9b4fe1dc5e0660acf69b76bcfa8f5c62f669e843 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 14 Apr 2023 14:18:08 +0200 Subject: [PATCH 1/5] Fix restore script --- tools/restore_scodoc9_data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/restore_scodoc9_data.sh b/tools/restore_scodoc9_data.sh index 87f95a79..04f68183 100755 --- a/tools/restore_scodoc9_data.sh +++ b/tools/restore_scodoc9_data.sh @@ -42,7 +42,7 @@ then DB_DEST="SCODOC" else echo "restauration des données dans la configuration actuelle" - DB_CURRENT=$(su -c "(cd $SCODOC_DIR && source venv/bin/activate && flask scodoc-database -n)") + DB_CURRENT=$(su -c "(cd $SCODOC_DIR && source venv/bin/activate && flask scodoc-database -n)" "$SCODOC_USER") DB_DEST="$DB_CURRENT" KEEP_ENV="Y" if [ "$1" = "--keep-env" ] From c29187561a6372da35fd76ea149a6fb7313b1b0d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 14 Apr 2023 14:43:48 +0200 Subject: [PATCH 2/5] Fix base CSS paths --- app/templates/base.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/base.j2 b/app/templates/base.j2 index 640a4d72..c55f8703 100644 --- a/app/templates/base.j2 +++ b/app/templates/base.j2 @@ -3,8 +3,8 @@ {% block styles %} {{super()}} - - + + {% endblock %} {% block title %} From fac3337237aec18bc3e341aa96446892df4eb7b9 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 14 Apr 2023 15:03:41 +0200 Subject: [PATCH 3/5] Make symbol scu (sco_utils) available to all templates. --- app/scodoc/sco_utils.py | 4 +++- app/templates/base.j2 | 4 ++-- scodoc.py | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 14f6aa63..ffd87dc1 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -63,7 +63,9 @@ from app.scodoc import sco_xml import sco_version # le répertoire static, lié à chaque release pour éviter les problèmes de caches -STATIC_DIR = "/ScoDoc/static/links/" + sco_version.SCOVERSION +STATIC_DIR = ( + os.environ.get("SCRIPT_NAME", "") + "/ScoDoc/static/links/" + sco_version.SCOVERSION +) # ----- CALCUL ET PRESENTATION DES NOTES NOTES_PRECISION = 1e-4 # evite eventuelles erreurs d'arrondis diff --git a/app/templates/base.j2 b/app/templates/base.j2 index c55f8703..99fe4eee 100644 --- a/app/templates/base.j2 +++ b/app/templates/base.j2 @@ -3,8 +3,8 @@ {% block styles %} {{super()}} - - + + {% endblock %} {% block title %} diff --git a/scodoc.py b/scodoc.py index 1640f907..2fd0f9a2 100755 --- a/scodoc.py +++ b/scodoc.py @@ -46,6 +46,7 @@ from app.scodoc import sco_dump_db from app.scodoc.sco_logos import make_logo_local from app.scodoc.sco_permissions import Permission from app.views import notes, scolar +import app.scodoc.sco_utils as scu import tools from tools.fakedatabase import create_test_api_database @@ -55,6 +56,12 @@ app = create_app(RunningConfig) cli.register(app) +@app.context_processor +def inject_sco_utils(): + "Make scu available in all Jinja templates" + return dict(scu=scu) + + @app.shell_context_processor def make_shell_context(): import numpy as np From b998a14fadb2b306264c4be40010ec901bd92ed2 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 14 Apr 2023 15:14:10 +0200 Subject: [PATCH 4/5] fix static css links --- app/templates/base.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/base.j2 b/app/templates/base.j2 index 99fe4eee..7097fdb8 100644 --- a/app/templates/base.j2 +++ b/app/templates/base.j2 @@ -3,8 +3,8 @@ {% block styles %} {{super()}} - - + + {% endblock %} {% block title %} From bff7e40fd813305e28ed2a876418ff6c7ca6af9a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 14 Apr 2023 15:15:54 +0200 Subject: [PATCH 5/5] fix static css links --- app/templates/base.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/base.j2 b/app/templates/base.j2 index 7097fdb8..81287daa 100644 --- a/app/templates/base.j2 +++ b/app/templates/base.j2 @@ -3,8 +3,8 @@ {% block styles %} {{super()}} - - + + {% endblock %} {% block title %}