Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/deposit_status.py
# Copyright (C) 2017-2018 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 rest_framework import status | from rest_framework import status | ||||
from .common import SWHBaseDeposit | from .common import SWHBaseDeposit | ||||
Show All 36 Lines | def get(self, req, collection_name, deposit_id, format=None): | ||||
context = { | context = { | ||||
"deposit_id": deposit.id, | "deposit_id": deposit.id, | ||||
"status_detail": status_detail, | "status_detail": status_detail, | ||||
} | } | ||||
keys = ( | keys = ( | ||||
"status", | "status", | ||||
"swh_id", | "swh_id", | ||||
"swh_id_context", | "swh_id_context", | ||||
"swh_anchor_id", | |||||
"swh_anchor_id_context", | |||||
"external_id", | "external_id", | ||||
) | ) | ||||
for k in keys: | for k in keys: | ||||
context[k] = getattr(deposit, k, None) | context[k] = getattr(deposit, k, None) | ||||
return render( | return render( | ||||
req, | req, | ||||
"deposit/status.xml", | "deposit/status.xml", | ||||
context=context, | context=context, | ||||
content_type="application/xml", | content_type="application/xml", | ||||
status=status.HTTP_200_OK, | status=status.HTTP_200_OK, | ||||
) | ) |