Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/content.py
Show First 20 Lines • Show All 320 Lines • ▼ Show 20 Lines | content_metadata = ContentMetadata( | ||||
filename=filename or "", | filename=filename or "", | ||||
directory=directory_id, | directory=directory_id, | ||||
revision=None, | revision=None, | ||||
release=None, | release=None, | ||||
snapshot=None, | snapshot=None, | ||||
origin_url=origin_url, | origin_url=origin_url, | ||||
) | ) | ||||
swh_objects = [ | swh_objects = [] | ||||
if content_checksums: | |||||
swh_objects.append( | |||||
SWHObjectInfo( | SWHObjectInfo( | ||||
object_type=ObjectType.CONTENT, object_id=content_checksums.get("sha1_git") | object_type=ObjectType.CONTENT, | ||||
object_id=content_checksums.get("sha1_git"), | |||||
) | |||||
) | ) | ||||
] | |||||
if directory_id: | if directory_id: | ||||
swh_objects.append( | swh_objects.append( | ||||
SWHObjectInfo(object_type=ObjectType.DIRECTORY, object_id=directory_id) | SWHObjectInfo(object_type=ObjectType.DIRECTORY, object_id=directory_id) | ||||
) | ) | ||||
if snapshot_context: | if snapshot_context: | ||||
swh_objects.append( | swh_objects.append( | ||||
Show All 25 Lines | if breadcrumbs: | ||||
content_path = "/".join([bc["name"] for bc in breadcrumbs]) | content_path = "/".join([bc["name"] for bc in breadcrumbs]) | ||||
heading += " - %s" % content_path | heading += " - %s" % content_path | ||||
return render( | return render( | ||||
request, | request, | ||||
"browse/content.html", | "browse/content.html", | ||||
{ | { | ||||
"heading": heading, | "heading": heading, | ||||
"swh_object_id": swhids_info[0]["swhid"], | "swh_object_id": swhids_info[0]["swhid"] if swhids_info else "", | ||||
"swh_object_name": "Content", | "swh_object_name": "Content", | ||||
"swh_object_metadata": content_metadata, | "swh_object_metadata": content_metadata, | ||||
"content": content, | "content": content, | ||||
"content_size": content_data.get("length"), | "content_size": content_data.get("length"), | ||||
"max_content_size": content_display_max_size, | "max_content_size": content_display_max_size, | ||||
"filename": filename, | "filename": filename, | ||||
"encoding": content_data.get("encoding"), | "encoding": content_data.get("encoding"), | ||||
"mimetype": mimetype, | "mimetype": mimetype, | ||||
Show All 18 Lines |