Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/private/__init__.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2019 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 swh.deposit import utils | from swh.deposit import utils | ||||
from ...config import METADATA_TYPE | from ...config import METADATA_TYPE, SWHDefaultConfig | ||||
from ...models import DepositRequest, Deposit | from ...models import DepositRequest, Deposit | ||||
from rest_framework.permissions import AllowAny | from rest_framework.permissions import AllowAny | ||||
from swh.deposit.api.common import SWHAPIView | from swh.deposit.api.common import SWHAPIView | ||||
from swh.deposit.errors import make_error_dict, NOT_FOUND | from swh.deposit.errors import make_error_dict, NOT_FOUND | ||||
Show All 34 Lines | def _metadata_get(self, deposit): | ||||
metadata dict from the deposit. | metadata dict from the deposit. | ||||
""" | """ | ||||
metadata = (m.metadata for m in self._deposit_requests( | metadata = (m.metadata for m in self._deposit_requests( | ||||
deposit, request_type=METADATA_TYPE)) | deposit, request_type=METADATA_TYPE)) | ||||
return utils.merge(*metadata) | return utils.merge(*metadata) | ||||
class SWHPrivateAPIView(SWHAPIView): | class SWHPrivateAPIView(SWHDefaultConfig, SWHAPIView): | ||||
"""Mixin intended as private api (so no authentication) based API view | """Mixin intended as private api (so no authentication) based API view | ||||
(for the private ones). | (for the private ones). | ||||
""" | """ | ||||
authentication_classes = () | authentication_classes = () | ||||
permission_classes = (AllowAny, ) | permission_classes = (AllowAny, ) | ||||
def checks(self, req, collection_name, deposit_id=None): | def checks(self, req, collection_name, deposit_id=None): | ||||
Show All 27 Lines |