Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/snapshot_context.py
Show All 11 Lines | |||||
from django.core.cache import cache | from django.core.cache import cache | ||||
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 | ||||
import sentry_sdk | import sentry_sdk | ||||
from swh.model.identifiers import ( | from swh.model.identifiers import ( | ||||
persistent_identifier, | swhid, | ||||
snapshot_identifier, | snapshot_identifier, | ||||
CONTENT, | CONTENT, | ||||
DIRECTORY, | DIRECTORY, | ||||
REVISION, | REVISION, | ||||
RELEASE, | RELEASE, | ||||
SNAPSHOT, | SNAPSHOT, | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 465 Lines • ▼ Show 20 Lines | else: | ||||
releases_url = reverse("browse-snapshot-releases", url_args=url_args) | releases_url = reverse("browse-snapshot-releases", url_args=url_args) | ||||
releases = list(reversed(releases)) | releases = list(reversed(releases)) | ||||
snapshot_sizes = service.lookup_snapshot_sizes(snapshot_id) | snapshot_sizes = service.lookup_snapshot_sizes(snapshot_id) | ||||
is_empty = sum(snapshot_sizes.values()) == 0 | is_empty = sum(snapshot_sizes.values()) == 0 | ||||
swh_snp_id = persistent_identifier("snapshot", snapshot_id) | swh_snp_id = swhid("snapshot", snapshot_id) | ||||
if visit_info: | if visit_info: | ||||
timestamp = format_utc_iso_date(visit_info["date"]) | timestamp = format_utc_iso_date(visit_info["date"]) | ||||
if origin_info: | if origin_info: | ||||
browse_view_name = f"browse-origin-{browse_context}" | browse_view_name = f"browse-origin-{browse_context}" | ||||
else: | else: | ||||
browse_view_name = f"browse-snapshot-{browse_context}" | browse_view_name = f"browse-snapshot-{browse_context}" | ||||
▲ Show 20 Lines • Show All 955 Lines • Show Last 20 Lines |