Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/directory.py
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | try: | ||||
raise NotFoundExc(error_message) | raise NotFoundExc(error_message) | ||||
if snapshot_context: | if snapshot_context: | ||||
snapshot_context["visit_info"] = None | snapshot_context["visit_info"] = None | ||||
except Exception as exc: | except Exception as exc: | ||||
return handle_view_exception(request, exc) | return handle_view_exception(request, exc) | ||||
path_info = gen_path_info(path) | path_info = gen_path_info(path) | ||||
query_params = {"origin": origin_url} | query_params = {"origin_url": origin_url} | ||||
breadcrumbs = [] | breadcrumbs = [] | ||||
breadcrumbs.append( | breadcrumbs.append( | ||||
{ | { | ||||
"name": root_sha1_git[:7], | "name": root_sha1_git[:7], | ||||
"url": reverse( | "url": reverse( | ||||
"browse-directory", | "browse-directory", | ||||
url_args={"sha1_git": root_sha1_git}, | url_args={"sha1_git": root_sha1_git}, | ||||
Show All 35 Lines | def directory_browse(request, sha1_git, path=None): | ||||
for f in files: | for f in files: | ||||
query_string = "sha1_git:" + f["target"] | query_string = "sha1_git:" + f["target"] | ||||
f["url"] = reverse( | f["url"] = reverse( | ||||
"browse-content", | "browse-content", | ||||
url_args={"query_string": query_string}, | url_args={"query_string": query_string}, | ||||
query_params={ | query_params={ | ||||
"path": root_sha1_git + "/" + path + f["name"], | "path": root_sha1_git + "/" + path + f["name"], | ||||
"origin": origin_url, | "origin_url": origin_url, | ||||
}, | }, | ||||
) | ) | ||||
if f["length"] is not None: | if f["length"] is not None: | ||||
sum_file_sizes += f["length"] | sum_file_sizes += f["length"] | ||||
f["length"] = filesizeformat(f["length"]) | f["length"] = filesizeformat(f["length"]) | ||||
if f["name"].lower().startswith("readme"): | if f["name"].lower().startswith("readme"): | ||||
readmes[f["name"]] = f["checksums"]["sha1"] | readmes[f["name"]] = f["checksums"]["sha1"] | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |