Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/private/deposit_update_status.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 Dict | |||||
from rest_framework.parsers import JSONParser | from rest_framework.parsers import JSONParser | ||||
from swh.model.identifiers import DIRECTORY, REVISION, SNAPSHOT, swhid | from swh.model.identifiers import DIRECTORY, REVISION, SNAPSHOT, swhid | ||||
from . import APIPrivateView | from . import APIPrivateView | ||||
from ...errors import BAD_REQUEST, DepositError | from ...errors import BAD_REQUEST, DepositError | ||||
from ...models import DEPOSIT_STATUS_DETAIL, DEPOSIT_STATUS_LOAD_SUCCESS, Deposit | from ...models import DEPOSIT_STATUS_DETAIL, DEPOSIT_STATUS_LOAD_SUCCESS, Deposit | ||||
from ..common import APIPut, ParsedRequestHeaders | from ..common import APIPut, ParsedRequestHeaders | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | ): | ||||
return {} | return {} | ||||
def process_put( | def process_put( | ||||
self, | self, | ||||
request, | request, | ||||
headers: ParsedRequestHeaders, | headers: ParsedRequestHeaders, | ||||
collection_name: str, | collection_name: str, | ||||
deposit_id: int, | deposit_id: int, | ||||
) -> Dict: | ) -> None: | ||||
"""Update the deposit with status and SWHIDs | """Update the deposit with status and SWHIDs | ||||
Returns: | Returns: | ||||
204 No content | 204 No content | ||||
400 Bad request if checks fail | 400 Bad request if checks fail | ||||
""" | """ | ||||
data = request.data | data = request.data | ||||
Show All 21 Lines | ) -> None: | ||||
"anchor": rev_id, | "anchor": rev_id, | ||||
"path": "/", | "path": "/", | ||||
}, | }, | ||||
) | ) | ||||
else: # rejected | else: # rejected | ||||
deposit.status = status | deposit.status = status | ||||
deposit.save() | deposit.save() | ||||
return {} |