Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/snapshot_context.py
Show First 20 Lines • Show All 474 Lines • ▼ Show 20 Lines | if origin_url: | ||||
) | ) | ||||
if timestamp is not None: | if timestamp is not None: | ||||
query_params["timestamp"] = format_utc_iso_date( | query_params["timestamp"] = format_utc_iso_date( | ||||
timestamp, "%Y-%m-%dT%H:%M:%SZ" | timestamp, "%Y-%m-%dT%H:%M:%SZ" | ||||
) | ) | ||||
visit_url = reverse("browse-origin-directory", query_params=query_params) | visit_url = reverse("browse-origin-directory", query_params=query_params) | ||||
visit_info["url"] = visit_url | visit_info["url"] = directory_url = visit_url | ||||
anlambert: There is still some use of `visit_info.url` in a template so you should rather do
`visit_info… | |||||
branches_url = reverse("browse-origin-branches", query_params=query_params) | branches_url = reverse("browse-origin-branches", query_params=query_params) | ||||
releases_url = reverse("browse-origin-releases", query_params=query_params) | releases_url = reverse("browse-origin-releases", query_params=query_params) | ||||
else: | else: | ||||
assert snapshot_id is not None | assert snapshot_id is not None | ||||
branches, releases, aliases = get_snapshot_content(snapshot_id) | branches, releases, aliases = get_snapshot_content(snapshot_id) | ||||
url_args = {"snapshot_id": snapshot_id} | url_args = {"snapshot_id": snapshot_id} | ||||
directory_url = reverse("browse-snapshot-directory", url_args=url_args) | |||||
branches_url = reverse("browse-snapshot-branches", url_args=url_args) | branches_url = reverse("browse-snapshot-branches", url_args=url_args) | ||||
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_cache_id = f"swh_snapshot_{snapshot_id}_sizes" | snapshot_sizes_cache_id = f"swh_snapshot_{snapshot_id}_sizes" | ||||
snapshot_sizes = cache.get(snapshot_sizes_cache_id) | snapshot_sizes = cache.get(snapshot_sizes_cache_id) | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | if revision_id: | ||||
) | ) | ||||
if revision_info["message"]: | if revision_info["message"]: | ||||
message_lines = revision_info["message"].split("\n") | message_lines = revision_info["message"].split("\n") | ||||
revision_info["message_header"] = message_lines[0] | revision_info["message_header"] = message_lines[0] | ||||
else: | else: | ||||
revision_info["message_header"] = "" | revision_info["message_header"] = "" | ||||
snapshot_context = SnapshotContext( | snapshot_context = SnapshotContext( | ||||
directory_url=directory_url, | |||||
branch=branch_name, | branch=branch_name, | ||||
branch_alias=branch_name in aliases, | branch_alias=branch_name in aliases, | ||||
branches=branches, | branches=branches, | ||||
branches_url=branches_url, | branches_url=branches_url, | ||||
is_empty=is_empty, | is_empty=is_empty, | ||||
origin_info=origin_info, | origin_info=origin_info, | ||||
origin_visits_url=origin_visits_url, | origin_visits_url=origin_visits_url, | ||||
release=release_name, | release=release_name, | ||||
▲ Show 20 Lines • Show All 868 Lines • Show Last 20 Lines |
There is still some use of visit_info.url in a template so you should rather do
visit_info["url"] = directory_url = visit_url