From eba4663881feeda8311f12dea48bb8d3d9df049c Mon Sep 17 00:00:00 2001 From: Karolina Przerwa Date: Fri, 10 Jan 2025 16:31:23 +0100 Subject: [PATCH] identifiers: register legacy cds id --- site/cds_rdm/schemes.py | 16 +++++++++++++--- site/setup.cfg | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/site/cds_rdm/schemes.py b/site/cds_rdm/schemes.py index 05d6855..44665bf 100644 --- a/site/cds_rdm/schemes.py +++ b/site/cds_rdm/schemes.py @@ -47,7 +47,7 @@ def aleph(): def is_inspire(val): - """Test if argument is an inspire ID. + """Test if argument is an Inspire ID. Warning: INSPIRE IDs are just integers, with no structure, so this function will say any integer is an INSPIRE id @@ -61,7 +61,7 @@ def is_inspire_author(val): def inspire(): - """Define validator for inspire.""" + """Define validator for Inspire.""" return { "validator": is_inspire, "normalizer": lambda value: value, @@ -71,7 +71,7 @@ def inspire(): def inspire_author(): - """Define validator for inspire author.""" + """Define validator for Inspire author.""" return { "validator": is_inspire_author, "normalizer": lambda value: value, @@ -84,3 +84,13 @@ def is_legacy_cds(val): """Test if argument is a valid CERN person ID.""" pattern = r"^\d+$" return bool(re.match(pattern, val)) + + +def legacy_cds(): + """Define scheme for CDS.""" + return { + "validator": is_legacy_cds, + "normalizer": lambda value: value, + "filter": ["lcds"], + "url_generator": None, + } diff --git a/site/setup.cfg b/site/setup.cfg index 16b2486..d2fdd39 100644 --- a/site/setup.cfg +++ b/site/setup.cfg @@ -39,6 +39,7 @@ idutils.custom_schemes = aleph = cds_rdm.schemes:aleph inspire = cds_rdm.schemes:inspire inspire_author = cds_rdm.schemes:inspire_author + legacy_cds = cds_rdm.schemes:legacy_cds invenio_db.alembic = cds_rdm = cds_rdm:alembic invenio_db.models =