Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/service_document.py
# Copyright (C) 2017-2019 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 django.shortcuts import render | from django.shortcuts import render | ||||
from django.urls import reverse | from django.urls import reverse | ||||
from .common import SWHBaseDeposit, ACCEPT_PACKAGINGS | from .common import APIBase, ACCEPT_PACKAGINGS | ||||
from .common import ACCEPT_ARCHIVE_CONTENT_TYPES | from .common import ACCEPT_ARCHIVE_CONTENT_TYPES | ||||
from ..config import COL_IRI | from ..config import COL_IRI | ||||
from ..models import DepositClient, DepositCollection | from ..models import DepositClient, DepositCollection | ||||
class SWHServiceDocument(SWHBaseDeposit): | class APIServiceDocument(APIBase): | ||||
def get(self, req, *args, **kwargs): | def get(self, req, *args, **kwargs): | ||||
client = DepositClient.objects.get(username=req.user) | client = DepositClient.objects.get(username=req.user) | ||||
collections = {} | collections = {} | ||||
for col_id in client.collections: | for col_id in client.collections: | ||||
col = DepositCollection.objects.get(pk=col_id) | col = DepositCollection.objects.get(pk=col_id) | ||||
col_uri = req.build_absolute_uri(reverse(COL_IRI, args=[col.name])) | col_uri = req.build_absolute_uri(reverse(COL_IRI, args=[col.name])) | ||||
Show All 11 Lines |