Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/deposit_update.py
Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | ) -> Dict[str, Any]: | ||||
except ParserError: | except ParserError: | ||||
return make_error_dict( | return make_error_dict( | ||||
BAD_REQUEST, | BAD_REQUEST, | ||||
"Malformed xml metadata", | "Malformed xml metadata", | ||||
"The xml received is malformed. " | "The xml received is malformed. " | ||||
"Please ensure your metadata file is correctly formatted.", | "Please ensure your metadata file is correctly formatted.", | ||||
) | ) | ||||
if not metadata: | metadata_ok, error_details = check_metadata(metadata or {}) | ||||
return make_error_dict( | |||||
BAD_REQUEST, | |||||
"Empty body request is not supported", | |||||
"Atom entry deposit is supposed to send for metadata. " | |||||
"If the body is empty, there is no metadata.", | |||||
) | |||||
metadata_ok, error_details = check_metadata(metadata) | |||||
if not metadata_ok: | if not metadata_ok: | ||||
assert error_details, "Details should be set when a failure occurs" | assert error_details, "Details should be set when a failure occurs" | ||||
return make_error_dict( | return make_error_dict( | ||||
BAD_REQUEST, | BAD_REQUEST, | ||||
"Functional metadata checks failure", | "Functional metadata checks failure", | ||||
convert_status_detail(error_details), | convert_status_detail(error_details), | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |