Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/directory.py
# Copyright (C) 2017-2020 The Software Heritage developers | # Copyright (C) 2017-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import os | import os | ||||
from django.http import HttpResponse | from django.http import HttpResponse | ||||
from django.shortcuts import render, redirect | from django.shortcuts import render, redirect | ||||
from django.template.defaultfilters import filesizeformat | from django.template.defaultfilters import filesizeformat | ||||
import sentry_sdk | import sentry_sdk | ||||
from swh.web.common import service | |||||
from swh.web.common.utils import reverse, gen_path_info | from swh.web.browse.browseurls import browse_route | ||||
from swh.web.common.exc import handle_view_exception, NotFoundExc | from swh.web.browse.snapshot_context import get_snapshot_context | ||||
from swh.web.browse.utils import ( | from swh.web.browse.utils import ( | ||||
get_directory_entries, | get_directory_entries, | ||||
get_snapshot_context, | |||||
get_readme_to_display, | get_readme_to_display, | ||||
get_swh_persistent_ids, | get_swh_persistent_ids, | ||||
gen_link, | gen_link, | ||||
) | ) | ||||
from swh.web.common import service | |||||
from swh.web.browse.browseurls import browse_route | from swh.web.common.exc import handle_view_exception, NotFoundExc | ||||
from swh.web.common.utils import reverse, gen_path_info | |||||
@browse_route( | @browse_route( | ||||
r"directory/(?P<sha1_git>[0-9a-f]+)/", | r"directory/(?P<sha1_git>[0-9a-f]+)/", | ||||
r"directory/(?P<sha1_git>[0-9a-f]+)/(?P<path>.+)/", | r"directory/(?P<sha1_git>[0-9a-f]+)/(?P<path>.+)/", | ||||
view_name="browse-directory", | view_name="browse-directory", | ||||
checksum_args=["sha1_git"], | checksum_args=["sha1_git"], | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 179 Lines • Show Last 20 Lines |