Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/urls.py
# Copyright (C) 2017-2020 The Software Heritage developers | # Copyright (C) 2017-2021 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 | ||||
"""SWH's deposit api URL Configuration | """SWH's deposit api URL Configuration | ||||
""" | """ | ||||
from django.conf.urls import url | from django.conf.urls import url | ||||
from django.shortcuts import render | from django.shortcuts import render | ||||
from ..config import COL_IRI, CONT_FILE_IRI, EDIT_IRI, EM_IRI, SD_IRI, SE_IRI, STATE_IRI | from ..config import ( | ||||
COL_IRI, | |||||
COLLECTION_LIST, | |||||
CONT_FILE_IRI, | |||||
EDIT_IRI, | |||||
EM_IRI, | |||||
SD_IRI, | |||||
SE_IRI, | |||||
STATE_IRI, | |||||
) | |||||
from .collection import CollectionAPI | from .collection import CollectionAPI | ||||
from .collection_list import CollectionListAPI | |||||
from .content import ContentAPI | from .content import ContentAPI | ||||
from .edit import EditAPI | from .edit import EditAPI | ||||
from .edit_media import EditMediaAPI | from .edit_media import EditMediaAPI | ||||
from .service_document import ServiceDocumentAPI | from .service_document import ServiceDocumentAPI | ||||
from .state import StateAPI | from .state import StateAPI | ||||
from .sword_edit import SwordEditAPI | from .sword_edit import SwordEditAPI | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | urlpatterns = [ | ||||
# -> GET | # -> GET | ||||
url( | url( | ||||
r"^(?P<collection_name>[^/]+)/(?P<deposit_id>[^/]+)/content/$", | r"^(?P<collection_name>[^/]+)/(?P<deposit_id>[^/]+)/content/$", | ||||
ContentAPI.as_view(), | ContentAPI.as_view(), | ||||
name=CONT_FILE_IRI, | name=CONT_FILE_IRI, | ||||
), # specification is not clear about | ), # specification is not clear about | ||||
# File-IRI, we assume it's the same as | # File-IRI, we assume it's the same as | ||||
# the Cont-IRI one | # the Cont-IRI one | ||||
url( | |||||
r"^(?P<collection_name>[^/]+)/list/$", | |||||
ardumont: Unsure about my comment here ^
I separated it from the main collection.py module for technical… | |||||
Done Inline ActionsYes it makes sense to proceed like this. anlambert: Yes it makes sense to proceed like this. | |||||
CollectionListAPI.as_view(), | |||||
name=COLLECTION_LIST, | |||||
), | |||||
] | ] |
Unsure about my comment here ^
I separated it from the main collection.py module for technical reason [1] and
readability (simpler to read it in a dedicated module).
[1] sounds unlikely that mixing the classes needed for pagination and listing will work
with the APIPost class in the main collection.CollectionAPI class