Skip to content

Commit

Permalink
Merge pull request #5566 from camptocamp/backport-oldapi-redirect
Browse files Browse the repository at this point in the history
Fix the route redirect on non empty entrypoint
  • Loading branch information
sbrunner authored Nov 25, 2019
2 parents 0361704 + 0659785 commit 40bd954
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions geoportal/c2cgeoportal_geoportal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,7 @@ def add_api_route(name: str, attr: str, path: str, renderer: str):
add_api_route("apijsmap", "apijsmap", "/api.js.map", "/etc/static-ngeo/api.js.map")
add_api_route("apicss", "apicss", "/api.css", "/etc/static-ngeo/api.css")
add_api_route("apihelp", "apihelp", "/apihelp/index.html", "/etc/geomapfish/static/apihelp/index.html")
c2cgeoportal_geoportal.views.add_redirect(
config, "apihelp_redirect", "/apihelp.html", "/apihelp/index.html"
)
c2cgeoportal_geoportal.views.add_redirect(config, "apihelp_redirect", "/apihelp.html", "apihelp")

config.add_route("themes", "/themes", request_method="GET", pregenerator=C2CPregenerator(role=True))

Expand Down
3 changes: 1 addition & 2 deletions geoportal/c2cgeoportal_geoportal/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def add_ending_slash(request):

def add_redirect(config, name, from_, to):
def redirect_view(request):
del request # unused
return HTTPFound(location=to)
return HTTPFound(location=request.route_url(to))

config.add_route(name, from_, request_method="GET")
config.add_view(redirect_view, route_name=name)

0 comments on commit 40bd954

Please sign in to comment.