Changeset View
Changeset View
Standalone View
Standalone View
swh/web/admin/deposit.py
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | try: | ||||
swhid = QualifiedSWHID.from_string(d["swhid_context"]) | swhid = QualifiedSWHID.from_string(d["swhid_context"]) | ||||
provenance = swhid.origin | provenance = swhid.origin | ||||
data_dict["uri"] = provenance # could be None | data_dict["uri"] = provenance # could be None | ||||
# This could be large. As this is not displayed yet, drop it to avoid | # This could be large. As this is not displayed yet, drop it to avoid | ||||
# cluttering the data dict | # cluttering the data dict | ||||
data_dict.pop("raw_metadata", None) | data_dict.pop("raw_metadata", None) | ||||
ardumont: Note it should already be present here... (provided by the deposit listing api).
But i won't… | |||||
data_list.append(data_dict) | data_list.append(data_dict) | ||||
table_data["data"] = data_list | table_data["data"] = data_list | ||||
for row in table_data["data"]: | for row in table_data["data"]: | ||||
metadata = get_deposit_raw_metadata(row["id"]) | metadata = get_deposit_raw_metadata(row["id"]) | ||||
if metadata: | if metadata: | ||||
row["raw_metadata"] = metadata[-1] | row["raw_metadata"] = metadata | ||||
else: | else: | ||||
row["raw_metadata"] = None | row["raw_metadata"] = None | ||||
except Exception as exc: | except Exception as exc: | ||||
sentry_sdk.capture_exception(exc) | sentry_sdk.capture_exception(exc) | ||||
table_data["error"] = f"Could not retrieve deposits: {exc!r}" | table_data["error"] = f"Could not retrieve deposits: {exc!r}" | ||||
return JsonResponse(table_data) | return JsonResponse(table_data) |
Note it should already be present here... (provided by the deposit listing api).
But i won't spend more time on this, i just want to unstuck the functionality
to work.
Plus that will get scratch soon by @anlambert with the optimization work he is
currently working on (that code will end up in the deposit server).