Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/deposit_update.py
Show First 20 Lines • Show All 329 Lines • ▼ Show 20 Lines | ) -> Tuple[int, str, Dict]: | ||||
""" # noqa | """ # noqa | ||||
assert deposit_id is not None | assert deposit_id is not None | ||||
if request.content_type.startswith("multipart/"): | if request.content_type.startswith("multipart/"): | ||||
data = self._multipart_upload( | data = self._multipart_upload( | ||||
request, headers, collection_name, deposit_id=deposit_id | request, headers, collection_name, deposit_id=deposit_id | ||||
) | ) | ||||
return (status.HTTP_201_CREATED, EM_IRI, data) | return (status.HTTP_201_CREATED, EM_IRI, data) | ||||
content_length = headers["content-length"] or 0 | |||||
if content_length == 0 and headers["in-progress"] is False: | |||||
# check for final empty post | # check for final empty post | ||||
# source: http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html | # source: http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html | ||||
# #continueddeposit_complete | # #continueddeposit_complete | ||||
if headers["content-length"] == 0 and headers["in-progress"] is False: | |||||
data = self._empty_post(request, headers, collection_name, deposit_id) | data = self._empty_post(request, headers, collection_name, deposit_id) | ||||
return (status.HTTP_200_OK, EDIT_SE_IRI, data) | return (status.HTTP_200_OK, EDIT_SE_IRI, data) | ||||
data = self._atom_entry( | data = self._atom_entry( | ||||
request, headers, collection_name, deposit_id=deposit_id | request, headers, collection_name, deposit_id=deposit_id | ||||
) | ) | ||||
return (status.HTTP_201_CREATED, EM_IRI, data) | return (status.HTTP_201_CREATED, EM_IRI, data) | ||||
ardumont: No need for that elif, headers['in-progress'] is False if not provided. | |||||
def process_delete(self, req, collection_name: str, deposit_id: int) -> Dict: | def process_delete(self, req, collection_name: str, deposit_id: int) -> Dict: | ||||
"""Delete the container (deposit). | """Delete the container (deposit). | ||||
source: http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_deleteconteiner # noqa | source: http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_deleteconteiner # noqa | ||||
""" | """ | ||||
return self._delete_deposit(collection_name, deposit_id) | return self._delete_deposit(collection_name, deposit_id) |
No need for that elif, headers['in-progress'] is False if not provided.