Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/revision.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2019 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 hashlib | import hashlib | ||||
import json | import json | ||||
import textwrap | import textwrap | ||||
from django.http import HttpResponse | from django.http import HttpResponse | ||||
from django.shortcuts import render | from django.shortcuts import render | ||||
from django.template.defaultfilters import filesizeformat | from django.template.defaultfilters import filesizeformat | ||||
from django.utils.html import escape | from django.utils.html import escape | ||||
from django.utils.safestring import mark_safe | from django.utils.safestring import mark_safe | ||||
from swh.model.identifiers import persistent_identifier | from swh.model.identifiers import persistent_identifier | ||||
from swh.web.common import service | |||||
from swh.web.common.utils import ( | |||||
reverse, | |||||
format_utc_iso_date, | |||||
gen_path_info, | |||||
swh_object_icons, | |||||
) | |||||
from swh.web.common.exc import NotFoundExc, handle_view_exception | |||||
from swh.web.browse.browseurls import browse_route | from swh.web.browse.browseurls import browse_route | ||||
from swh.web.browse.snapshot_context import get_snapshot_context | |||||
from swh.web.browse.utils import ( | from swh.web.browse.utils import ( | ||||
gen_link, | gen_link, | ||||
gen_revision_link, | gen_revision_link, | ||||
gen_revision_url, | gen_revision_url, | ||||
get_snapshot_context, | |||||
get_revision_log_url, | get_revision_log_url, | ||||
get_directory_entries, | get_directory_entries, | ||||
gen_directory_link, | gen_directory_link, | ||||
request_content, | request_content, | ||||
prepare_content_for_display, | prepare_content_for_display, | ||||
content_display_max_size, | content_display_max_size, | ||||
gen_snapshot_link, | gen_snapshot_link, | ||||
get_readme_to_display, | get_readme_to_display, | ||||
get_swh_persistent_ids, | get_swh_persistent_ids, | ||||
format_log_entries, | format_log_entries, | ||||
gen_person_mail_link, | gen_person_mail_link, | ||||
) | ) | ||||
from swh.web.common import service | |||||
from swh.web.common.exc import NotFoundExc, handle_view_exception | |||||
from swh.web.common.utils import ( | |||||
reverse, | |||||
format_utc_iso_date, | |||||
gen_path_info, | |||||
swh_object_icons, | |||||
) | |||||
def _gen_content_url(revision, query_string, path, snapshot_context): | def _gen_content_url(revision, query_string, path, snapshot_context): | ||||
if snapshot_context: | if snapshot_context: | ||||
url_args = snapshot_context["url_args"] | url_args = snapshot_context["url_args"] | ||||
url_args["path"] = path | url_args["path"] = path | ||||
query_params = snapshot_context["query_params"] | query_params = snapshot_context["query_params"] | ||||
query_params["revision"] = revision["id"] | query_params["revision"] = revision["id"] | ||||
▲ Show 20 Lines • Show All 543 Lines • Show Last 20 Lines |