Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/private/deposit_check.py
# Copyright (C) 2017-2018 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 | ||||
import json | import json | ||||
import re | import re | ||||
import tarfile | import tarfile | ||||
import zipfile | import zipfile | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | def _check_metadata(self, metadata): | ||||
tuple (status, error_detail): True, None if metadata are | tuple (status, error_detail): True, None if metadata are | ||||
ok (False, <detailed-error>) otherwise. | ok (False, <detailed-error>) otherwise. | ||||
""" | """ | ||||
required_fields = { | required_fields = { | ||||
'url': False, | 'url': False, | ||||
'external_identifier': False, | 'external_identifier': False, | ||||
'author': False, | 'author': False, | ||||
'codemeta:dateCreated': False, | |||||
moranegg: I'm against making this metadata obligatory because I think it will break the chain with HAL | |||||
} | } | ||||
alternate_fields = { | alternate_fields = { | ||||
('name', 'title'): False, # alternate field, at least one | ('name', 'title'): False, # alternate field, at least one | ||||
# of them must be present | # of them must be present | ||||
} | } | ||||
for field, value in metadata.items(): | for field, value in metadata.items(): | ||||
for name in required_fields: | for name in required_fields: | ||||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |
I'm against making this metadata obligatory because I think it will break the chain with HAL