From 3e5020f80ca8f8be7fa718c9de465aad3dd85243 Mon Sep 17 00:00:00 2001 From: Zacharias Zacharodimos Date: Fri, 22 Sep 2023 10:20:42 +0200 Subject: [PATCH] legacy: add parent doi link on records only --- site/zenodo_rdm/legacy/services.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/site/zenodo_rdm/legacy/services.py b/site/zenodo_rdm/legacy/services.py index 2e617cf8..678d1ffc 100644 --- a/site/zenodo_rdm/legacy/services.py +++ b/site/zenodo_rdm/legacy/services.py @@ -25,7 +25,7 @@ RDMRecordService, RDMRecordServiceConfig, ) -from invenio_rdm_records.services.config import has_doi, is_record_and_has_parent_doi +from invenio_rdm_records.services.config import has_doi from invenio_records_resources.services import ConditionalLink from invenio_records_resources.services.base.config import FromConfig from invenio_records_resources.services.base.links import preprocess_vars @@ -51,6 +51,11 @@ def is_published(record, ctx): return record.is_published +def is_record_and_has_parent_doi(record, ctx): + """Determine if record has parent doi.""" + return is_record(record, ctx) and has_doi(record.parent, ctx) + + class LegacyRecordLink(RecordLink): """Legacy record links with bucket information."""