Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/private/deposit_read.py
Show All 9 Lines | |||||
from contextlib import contextmanager | from contextlib import contextmanager | ||||
from django.http import FileResponse | from django.http import FileResponse | ||||
from rest_framework import status | from rest_framework import status | ||||
from swh.core import tarball | from swh.core import tarball | ||||
from swh.model import identifiers | from swh.model import identifiers | ||||
from swh.deposit.utils import normalize_date | from swh.deposit.utils import normalize_date | ||||
from swh.deposit import utils | |||||
from . import DepositReadMixin, SWHPrivateAPIView | from . import DepositReadMixin, SWHPrivateAPIView | ||||
from ...config import SWH_PERSON, ARCHIVE_TYPE | from ...config import SWH_PERSON, ARCHIVE_TYPE | ||||
from ..common import SWHGetDepositAPI | from ..common import SWHGetDepositAPI | ||||
from ...models import Deposit | from ...models import Deposit | ||||
@contextmanager | @contextmanager | ||||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | def metadata_read(self, deposit): | ||||
Dictionary of data representing the deposit to inject in swh. | Dictionary of data representing the deposit to inject in swh. | ||||
""" | """ | ||||
metadata = self._metadata_get(deposit) | metadata = self._metadata_get(deposit) | ||||
# Read information metadata | # Read information metadata | ||||
data = { | data = { | ||||
'origin': { | 'origin': { | ||||
'type': 'deposit', | 'type': 'deposit', | ||||
'url': utils.origin_url_from(deposit), | 'url': deposit.origin_url, | ||||
ardumont: As this should never change in the deposit's life cycle.
We could probably have that as a model… | |||||
} | } | ||||
} | } | ||||
# revision | # revision | ||||
fullname = deposit.client.username | fullname = deposit.client.username | ||||
author_committer = SWH_PERSON | author_committer = SWH_PERSON | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |
As this should never change in the deposit's life cycle.
We could probably have that as a model column in the deposit (that'd ease introspection).
@moranegg: ^
Techically, that means:
@both what do you think?
(if we agree, that could go in another diff heh)