From 53db4d312ae5e9e431ca931a4c9bd8691b1b9007 Mon Sep 17 00:00:00 2001 From: ChristopherSpelt Date: Tue, 24 Sep 2024 16:55:30 +0200 Subject: [PATCH] Create 404 page --- amt/locale/base.pot | 12 ++++++++++-- amt/locale/en_US/LC_MESSAGES/messages.mo | Bin 451 -> 451 bytes amt/locale/en_US/LC_MESSAGES/messages.po | 12 ++++++++++-- amt/locale/nl_FY/LC_MESSAGES/messages.mo | Bin 617 -> 617 bytes amt/locale/nl_FY/LC_MESSAGES/messages.po | 12 ++++++++++-- amt/locale/nl_NL/LC_MESSAGES/messages.mo | Bin 1796 -> 2031 bytes amt/locale/nl_NL/LC_MESSAGES/messages.po | 12 ++++++++++-- .../templates/errors/HTTPException.html.j2 | 9 ++++++++- .../errors/_HTTPException404.html.j2 | 4 ++++ tests/api/routes/test_project.py | 12 ++++++------ 10 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 amt/site/templates/errors/_HTTPException404.html.j2 diff --git a/amt/locale/base.pot b/amt/locale/base.pot index cf5306a8..1edf8b6d 100644 --- a/amt/locale/base.pot +++ b/amt/locale/base.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-09-18 11:47+0200\n" +"POT-Creation-Date: 2024-09-24 16:54+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -53,6 +53,14 @@ msgstr "" msgid "Details" msgstr "" +#: amt/site/templates/errors/_HTTPException404.html.j2:1 +msgid "Page not found" +msgstr "" + +#: amt/site/templates/errors/_HTTPException404.html.j2:3 +msgid "The page or file you requested is not found. Please check the URL." +msgstr "" + #: amt/site/templates/errors/_RequestValidation.html.j2:1 msgid "Request Validation Error" msgstr "" @@ -61,7 +69,7 @@ msgstr "" msgid "An error occurred" msgstr "" -#: amt/site/templates/layouts/base.html.j2:1 +#: amt/site/templates/layouts/base.html.j2:11 msgid "Algorithmic Management Toolkit (AMT)" msgstr "" diff --git a/amt/locale/en_US/LC_MESSAGES/messages.mo b/amt/locale/en_US/LC_MESSAGES/messages.mo index 16e21b645532d1a90f3f17ddd70992a8b5e9d6eb..4d43d9009c7f0491bf44f4f3fbad088212cf2e43 100644 GIT binary patch delta 19 acmX@ie3*H{1P&t;1w%6{Q5?Dl?A#0 delta 19 acmX@ie3*H{1P((B1w%tC6Z4HTv>5?DmIb;1 diff --git a/amt/locale/en_US/LC_MESSAGES/messages.po b/amt/locale/en_US/LC_MESSAGES/messages.po index 0a8134da..4d21a778 100644 --- a/amt/locale/en_US/LC_MESSAGES/messages.po +++ b/amt/locale/en_US/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-09-18 11:47+0200\n" +"POT-Creation-Date: 2024-09-24 16:54+0200\n" "PO-Revision-Date: 2024-07-25 21:01+0200\n" "Last-Translator: FULL NAME \n" "Language: en_US\n" @@ -54,6 +54,14 @@ msgstr "" msgid "Details" msgstr "" +#: amt/site/templates/errors/_HTTPException404.html.j2:1 +msgid "Page not found" +msgstr "" + +#: amt/site/templates/errors/_HTTPException404.html.j2:3 +msgid "The page or file you requested is not found. Please check the URL." +msgstr "" + #: amt/site/templates/errors/_RequestValidation.html.j2:1 msgid "Request Validation Error" msgstr "" @@ -62,7 +70,7 @@ msgstr "" msgid "An error occurred" msgstr "" -#: amt/site/templates/layouts/base.html.j2:1 +#: amt/site/templates/layouts/base.html.j2:11 msgid "Algorithmic Management Toolkit (AMT)" msgstr "" diff --git a/amt/locale/nl_FY/LC_MESSAGES/messages.mo b/amt/locale/nl_FY/LC_MESSAGES/messages.mo index a95e2f99370e49bb3477a2b40ed8162ed39a0b02..eff2a1f4dd71dba56c32d3fa02b975f920a05ecf 100644 GIT binary patch delta 21 ccmaFK@{(l(7bAy}iGrb-m8r>QA;xe<07U`?OaK4? delta 21 ccmaFK@{(l(7bAzEg@U1>m5KRgA;xe<07U}@OaK4? diff --git a/amt/locale/nl_FY/LC_MESSAGES/messages.po b/amt/locale/nl_FY/LC_MESSAGES/messages.po index 3bab5937..6d490c62 100644 --- a/amt/locale/nl_FY/LC_MESSAGES/messages.po +++ b/amt/locale/nl_FY/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-09-18 11:47+0200\n" +"POT-Creation-Date: 2024-09-24 16:54+0200\n" "PO-Revision-Date: 2024-07-25 21:01+0200\n" "Last-Translator: FULL NAME \n" "Language: nl_FY\n" @@ -54,6 +54,14 @@ msgstr "" msgid "Details" msgstr "" +#: amt/site/templates/errors/_HTTPException404.html.j2:1 +msgid "Page not found" +msgstr "" + +#: amt/site/templates/errors/_HTTPException404.html.j2:3 +msgid "The page or file you requested is not found. Please check the URL." +msgstr "" + #: amt/site/templates/errors/_RequestValidation.html.j2:1 msgid "Request Validation Error" msgstr "" @@ -62,7 +70,7 @@ msgstr "" msgid "An error occurred" msgstr "" -#: amt/site/templates/layouts/base.html.j2:1 +#: amt/site/templates/layouts/base.html.j2:11 msgid "Algorithmic Management Toolkit (AMT)" msgstr "" diff --git a/amt/locale/nl_NL/LC_MESSAGES/messages.mo b/amt/locale/nl_NL/LC_MESSAGES/messages.mo index 7b9aaf3b790c858cb369e497ba830433d80d0d37..c02e3f3667e3a6af35730eb7fb0b4c8bc07b0e04 100644 GIT binary patch delta 830 zcmYk(&ubG=5Ww-*B&MxRTB=ri5FKqRA`)nc9xRGhg&txNLGdP=>?Bzec5AZn*QJPh z(PJozC&8N_r~wapvmm1XK@U>of8Z9(rk%?;x8!mR zMhJ}l4Y++c#QXqS;Tg=~EONVfUY0MR~%=5DN z7}|b&abXvODF$2dc#@dM3iAczcCUF^LvNA2+zO82C**c(NqoJ(cPKU9m-lKaVH8U> z>V$sxWcuu>y2_$Oqn1>Irpm3TBQ3qw(RQr91nte`1v%eTudPz4Yo#GEUtYXWDs=Cr zpA5_tW%}r`BgNiSrkvXD)q>EIFwj_PdOZq#4ZHWVbCok2wJhfcDjm5IG<}uZfrb)Q srOxs)WxdcB-;4j{%i0L8HdtfL{J&>GPDf$fikhk|VWW+1K4ee)0iLdXdH?_b delta 598 zcmYMwJ4*vW6o%oGP0Yqyg278f5ib!eVjv(I1VzzCD=#33ot2d!h**eef}n*EmXL_x zPq0WJMH3S`h0149h35Tu$#)GC%x|F%wvQ@&j1;y!y41H*KT*JL5+$VBHJvuDV3Av? zqYAFDi*8~Qhw;FVFHrd!s^ATd-~(!(57dt|P<0%xt(E%L%Rmc9Q8$rBzOh-\n" "Language: nl_NL\n" @@ -54,6 +54,14 @@ msgstr "" msgid "Details" msgstr "" +#: amt/site/templates/errors/_HTTPException404.html.j2:1 +msgid "Page not found" +msgstr "Pagina niet gevonden" + +#: amt/site/templates/errors/_HTTPException404.html.j2:3 +msgid "The page or file you requested is not found. Please check the URL." +msgstr "De pagina die u wilde zien of het bestand dat u wilde bekijken is niet gevonden. Controleer de URL." + #: amt/site/templates/errors/_RequestValidation.html.j2:1 msgid "Request Validation Error" msgstr "Aanvraag Validatie Fout" @@ -62,7 +70,7 @@ msgstr "Aanvraag Validatie Fout" msgid "An error occurred" msgstr "Er is is een fout opgetreden" -#: amt/site/templates/layouts/base.html.j2:1 +#: amt/site/templates/layouts/base.html.j2:11 msgid "Algorithmic Management Toolkit (AMT)" msgstr "Algoritme Management Toolkit (AMT)" diff --git a/amt/site/templates/errors/HTTPException.html.j2 b/amt/site/templates/errors/HTTPException.html.j2 index 5223602a..bc9ac2c1 100644 --- a/amt/site/templates/errors/HTTPException.html.j2 +++ b/amt/site/templates/errors/HTTPException.html.j2 @@ -1,5 +1,12 @@ {% extends 'layouts/base.html.j2' %} {% block content %} -{% include 'errors/_HTTPException.html.j2' %} +
+ + {% if status_code == 404 %} + {% include 'errors/_HTTPException404.html.j2' %} + {% else %} + {% include 'errors/_HTTPException.html.j2' %} + {% endif %} +
{% endblock %} diff --git a/amt/site/templates/errors/_HTTPException404.html.j2 b/amt/site/templates/errors/_HTTPException404.html.j2 new file mode 100644 index 00000000..cab0dee3 --- /dev/null +++ b/amt/site/templates/errors/_HTTPException404.html.j2 @@ -0,0 +1,4 @@ +

{% trans %}Page not found{% endtrans %}

+

+{% trans %}The page or file you requested is not found. Please check the URL.{% endtrans %} +

diff --git a/tests/api/routes/test_project.py b/tests/api/routes/test_project.py index 272aea9d..f51c0d29 100644 --- a/tests/api/routes/test_project.py +++ b/tests/api/routes/test_project.py @@ -24,7 +24,7 @@ def test_get_unknown_project(client: TestClient) -> None: # then assert response.status_code == 404 assert response.headers["content-type"] == "text/html; charset=utf-8" - assert b"NotFound: Not found" in response.content + assert b"Page not found" in response.content def test_get_project_tasks(client: TestClient, db: DatabaseTestUtils) -> None: @@ -66,7 +66,7 @@ def test_get_system_card_unknown_project(client: TestClient) -> None: # then assert response.status_code == 404 assert response.headers["content-type"] == "text/html; charset=utf-8" - assert b"NotFound: Not found" in response.content + assert b"Page not found" in response.content # TODO: Test are now have hard coded URL paths because the system card @@ -95,7 +95,7 @@ def test_get_assessment_card_unknown_project(client: TestClient) -> None: # then assert response.status_code == 404 assert response.headers["content-type"] == "text/html; charset=utf-8" - assert b"NotFound: Not found" in response.content + assert b"Page not found" in response.content # TODO: Test are now have hard coded URL paths because the system card @@ -111,7 +111,7 @@ def test_get_assessment_card_unknown_assessment(client: TestClient, db: Database # then assert response.status_code == 404 assert response.headers["content-type"] == "text/html; charset=utf-8" - assert b"NotFound: Not found" in response.content + assert b"Page not found" in response.content # TODO: Test are now have hard coded URL paths because the system card @@ -140,7 +140,7 @@ def test_get_model_card_unknown_project(client: TestClient) -> None: # then assert response.status_code == 404 assert response.headers["content-type"] == "text/html; charset=utf-8" - assert b"NotFound: Not found" in response.content + assert b"Page not found" in response.content # TODO: Test are now have hard coded URL paths because the system card @@ -156,4 +156,4 @@ def test_get_assessment_card_unknown_model_card(client: TestClient, db: Database # then assert response.status_code == 404 assert response.headers["content-type"] == "text/html; charset=utf-8" - assert b"NotFound: Not found" in response.content + assert b"Page not found" in response.content