From 0b4b68aad7d1a71742caa3f3e8090f7c1e9f1f81 Mon Sep 17 00:00:00 2001 From: Glandos Date: Wed, 11 Jul 2018 13:23:56 +0200 Subject: [PATCH 1/2] Remove strict_slashes for / I don't know why, but on my setup (nginx + uwsgi), the `strict_slashes` (default to `True`) was causing an infinite loop. I think it could be safely removed for this route only. --- ihatemoney/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ihatemoney/web.py b/ihatemoney/web.py index 1e162024..6e876c03 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -198,7 +198,7 @@ def authenticate(project_id=None): return render_template("authenticate.html", form=form) -@main.route("/") +@main.route("/", strict_slashes=False) def home(): project_form = ProjectForm() auth_form = AuthenticationForm() From 86b8e9135a0025527dd23b21c66a1843bf777e58 Mon Sep 17 00:00:00 2001 From: Adrien CLERC Date: Wed, 11 Jul 2018 22:01:43 +0200 Subject: [PATCH 2/2] add test case --- ihatemoney/tests/tests.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ihatemoney/tests/tests.py b/ihatemoney/tests/tests.py index 3797f09d..fd72a8da 100644 --- a/ihatemoney/tests/tests.py +++ b/ihatemoney/tests/tests.py @@ -1434,6 +1434,12 @@ class APITestCase(IhatemoneyTestCase): class ServerTestCase(IhatemoneyTestCase): + def test_homepage(self): + # See https://github.com/spiral-project/ihatemoney/pull/358 + self.app.config['APPLICATION_ROOT'] = '/' + req = self.client.get("/") + self.assertStatus(200, req) + def test_unprefixed(self): self.app.config['APPLICATION_ROOT'] = '/' req = self.client.get("/foo/")