Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/origin.py
Show All 17 Lines | |||||
from swh.web.common.utils import format_utc_iso_date, parse_iso8601_date_to_utc, reverse | from swh.web.common.utils import format_utc_iso_date, parse_iso8601_date_to_utc, reverse | ||||
def redirect_to_new_route(request, new_route): | def redirect_to_new_route(request, new_route): | ||||
request_path = resolve(request.path_info) | request_path = resolve(request.path_info) | ||||
# Send all the url_args and the request_args as query params | # Send all the url_args and the request_args as query params | ||||
# eg /origin/<url:url-val>/log?path=test | # eg /origin/<url:url-val>/log?path=test | ||||
# will be send as /log?url=<url-val>&path=test | # will be send as /log?url=<url-val>&path=test | ||||
args = {**request_path.kwargs, **{k: v for k, v in request.GET.items()}} | args = {**request_path.kwargs, **request.GET.dict()} | ||||
return redirect(reverse(new_route, query_params=args), permanent=True,) | return redirect(reverse(new_route, query_params=args), permanent=True,) | ||||
@browse_route( | @browse_route( | ||||
r"origin/directory/", view_name="browse-origin-directory", | r"origin/directory/", view_name="browse-origin-directory", | ||||
) | ) | ||||
def origin_directory_browse(request): | def origin_directory_browse(request): | ||||
"""Django view for browsing the content of a directory associated | """Django view for browsing the content of a directory associated | ||||
▲ Show 20 Lines • Show All 276 Lines • Show Last 20 Lines |