Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/collection.py
# Copyright (C) 2017-2020 The Software Heritage developers | # Copyright (C) 2017-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from typing import Any, Dict, Optional, Tuple | from typing import Any, Dict, Optional, Tuple | ||||
from rest_framework import status | from rest_framework import status | ||||
from ..config import EDIT_SE_IRI | from ..config import EDIT_IRI | ||||
from ..parsers import ( | from ..parsers import ( | ||||
SWHAtomEntryParser, | SWHAtomEntryParser, | ||||
SWHFileUploadTarParser, | SWHFileUploadTarParser, | ||||
SWHFileUploadZipParser, | SWHFileUploadZipParser, | ||||
SWHMultiPartParser, | SWHMultiPartParser, | ||||
) | ) | ||||
from .common import ACCEPT_ARCHIVE_CONTENT_TYPES, APIPost | from .common import ACCEPT_ARCHIVE_CONTENT_TYPES, APIPost | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | ) -> Tuple[int, str, Dict[str, Any]]: | ||||
data = self._multipart_upload( | data = self._multipart_upload( | ||||
req, headers, collection_name, check_slug_is_present=True | req, headers, collection_name, check_slug_is_present=True | ||||
) | ) | ||||
else: | else: | ||||
data = self._atom_entry( | data = self._atom_entry( | ||||
req, headers, collection_name, check_slug_is_present=True | req, headers, collection_name, check_slug_is_present=True | ||||
) | ) | ||||
return status.HTTP_201_CREATED, EDIT_SE_IRI, data | return status.HTTP_201_CREATED, EDIT_IRI, data |