Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/common.py
Show All 35 Lines | |||||
from ..config import ( | from ..config import ( | ||||
ARCHIVE_KEY, | ARCHIVE_KEY, | ||||
ARCHIVE_TYPE, | ARCHIVE_TYPE, | ||||
CONT_FILE_IRI, | CONT_FILE_IRI, | ||||
DEPOSIT_STATUS_DEPOSITED, | DEPOSIT_STATUS_DEPOSITED, | ||||
DEPOSIT_STATUS_LOAD_SUCCESS, | DEPOSIT_STATUS_LOAD_SUCCESS, | ||||
DEPOSIT_STATUS_PARTIAL, | DEPOSIT_STATUS_PARTIAL, | ||||
EDIT_SE_IRI, | EDIT_IRI, | ||||
EM_IRI, | EM_IRI, | ||||
METADATA_KEY, | METADATA_KEY, | ||||
METADATA_TYPE, | METADATA_TYPE, | ||||
RAW_METADATA_KEY, | RAW_METADATA_KEY, | ||||
SE_IRI, | |||||
STATE_IRI, | STATE_IRI, | ||||
APIConfig, | APIConfig, | ||||
) | ) | ||||
from ..errors import ( | from ..errors import ( | ||||
BAD_REQUEST, | BAD_REQUEST, | ||||
CHECKSUM_MISMATCH, | CHECKSUM_MISMATCH, | ||||
ERROR_CONTENT, | ERROR_CONTENT, | ||||
FORBIDDEN, | FORBIDDEN, | ||||
▲ Show 20 Lines • Show All 823 Lines • ▼ Show 20 Lines | ) -> Dict[str, Any]: | ||||
Returns: | Returns: | ||||
Dictionary of keys with the iris' urls. | Dictionary of keys with the iris' urls. | ||||
""" | """ | ||||
args = [collection_name, deposit_id] | args = [collection_name, deposit_id] | ||||
return { | return { | ||||
iri: request.build_absolute_uri(reverse(iri, args=args)) | iri: request.build_absolute_uri(reverse(iri, args=args)) | ||||
for iri in [EM_IRI, EDIT_SE_IRI, CONT_FILE_IRI, STATE_IRI] | for iri in [EM_IRI, EDIT_IRI, CONT_FILE_IRI, SE_IRI, STATE_IRI] | ||||
} | } | ||||
def additional_checks( | def additional_checks( | ||||
self, | self, | ||||
request: Request, | request: Request, | ||||
headers: Dict[str, Any], | headers: Dict[str, Any], | ||||
collection_name: str, | collection_name: str, | ||||
deposit_id: Optional[int] = None, | deposit_id: Optional[int] = None, | ||||
▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | def process_post( | ||||
collection_name: str, | collection_name: str, | ||||
deposit_id: Optional[int] = None, | deposit_id: Optional[int] = None, | ||||
) -> Tuple[int, str, Dict]: | ) -> Tuple[int, str, Dict]: | ||||
"""Routine to deal with the deposit's processing. | """Routine to deal with the deposit's processing. | ||||
Returns | Returns | ||||
Tuple of: | Tuple of: | ||||
- response status code (200, 201, etc...) | - response status code (200, 201, etc...) | ||||
- key iri (EM_IRI, EDIT_SE_IRI, etc...) | - key iri (EM_IRI, EDIT_IRI, etc...) | ||||
- dictionary of the processing result | - dictionary of the processing result | ||||
""" | """ | ||||
pass | pass | ||||
class APIPut(APIBase, metaclass=ABCMeta): | class APIPut(APIBase, metaclass=ABCMeta): | ||||
"""Mixin for class to support PUT method. | """Mixin for class to support PUT method. | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |