Skip to content

Commit

Permalink
identifiers: register legacy cds id
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva committed Jan 10, 2025
1 parent f5b7b0d commit eba4663
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions site/cds_rdm/schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
}
1 change: 1 addition & 0 deletions site/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit eba4663

Please sign in to comment.