Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/private/deposit_check.py
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | def _check_metadata(self, metadata): | ||||
metadata (dict): Metadata dictionary to check for mandatory fields | metadata (dict): Metadata dictionary to check for mandatory fields | ||||
Returns: | Returns: | ||||
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, | |||||
'external_identifier': False, | |||||
'author': False, | 'author': False, | ||||
} | } | ||||
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(): | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |