Prefer shorter URL

Flask will pick the first route that matches. Decorators get applied
from innermost to outermost.

So if the same endpoint is served at `/abc` and `/123` the one used
when `url_for` is generating a URL is whichever decorator is lowest
(in terms of line number).

It doesn’t functionally make a difference, but it’s causing the
functional tests to fail at the moment. And shorter URLs are nicer, so
I think it makes sense to change here, rather than change the tests.
This commit is contained in:
Chris Hill-Scott
2019-11-13 15:10:16 +00:00
parent 0d2f1a0716
commit 37f0c4459b
2 changed files with 19 additions and 1 deletions

View File

@@ -105,8 +105,8 @@ def start_tour(service_id, template_id):
)
@main.route("/services/<uuid:service_id>/templates", methods=['GET', 'POST'])
@main.route("/services/<uuid:service_id>/templates/all", methods=['GET', 'POST'])
@main.route("/services/<uuid:service_id>/templates", methods=['GET', 'POST'])
@main.route("/services/<uuid:service_id>/templates/folders/<uuid:template_folder_id>", methods=['GET', 'POST'])
@main.route("/services/<uuid:service_id>/templates/<template_type:template_type>", methods=['GET', 'POST'])
@main.route("/services/<uuid:service_id>/templates/all/folders/<uuid:template_folder_id>", methods=['GET', 'POST'])