Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOI Validation #1484

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1484.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added validation to the `digital_object_identifier` Dataset field.
40 changes: 22 additions & 18 deletions ckanext/canada/i18n/ckanext-canada.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ckanext-canada 0.4.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-06-25 17:26+0000\n"
"POT-Creation-Date: 2024-06-25 18:45+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -255,12 +255,12 @@ msgstr ""
msgid "Suggestion Status"
msgstr ""

#: ckanext/canada/plugins.py:899
#: ckanext/canada/plugins.py:901
#: ckanext/canada/templates/public/package/snippets/resource_form.html:8
msgid "Previous"
msgstr ""

#: ckanext/canada/plugins.py:899
#: ckanext/canada/plugins.py:901
msgid "Next"
msgstr ""

Expand Down Expand Up @@ -546,75 +546,79 @@ msgstr ""
msgid "Open Government Portal (staging)"
msgstr ""

#: ckanext/canada/validators.py:118
#: ckanext/canada/validators.py:151
#, python-format
msgid "Tag \"%s\" length is less than minimum %s"
msgstr ""

#: ckanext/canada/validators.py:122
#: ckanext/canada/validators.py:155
#, python-format
msgid "Tag \"%s\" length is more than maximum %i"
msgstr ""

#: ckanext/canada/validators.py:126
#: ckanext/canada/validators.py:159
#, python-format
msgid "Tag \"%s\" may not contain consecutive spaces"
msgstr ""

#: ckanext/canada/validators.py:133
#: ckanext/canada/validators.py:166
#, python-format
msgid "Tag \"%s\" may not contain unprintable character U+%04x"
msgstr ""

#: ckanext/canada/validators.py:137
#: ckanext/canada/validators.py:170
#, python-format
msgid "Tag \"%s\" may not contain separator charater U+%04x"
msgstr ""

#: ckanext/canada/validators.py:153
#: ckanext/canada/validators.py:186
msgid "Badly formed hexadecimal UUID string"
msgstr ""

#: ckanext/canada/templates/internal/user/new_user_form.html:6
#: ckanext/canada/validators.py:165 ckanext/canada/validators.py:167
#: ckanext/canada/validators.py:198 ckanext/canada/validators.py:200
msgid "Please enter a valid email address."
msgstr ""

#: ckanext/canada/validators.py:182
#: ckanext/canada/validators.py:215
msgid "Invalid GeoJSON"
msgstr ""

#: ckanext/canada/validators.py:259
#: ckanext/canada/validators.py:292
msgid "Date may not be in the future when this record is marked ready to publish"
msgstr ""

#: ckanext/canada/validators.py:336
#: ckanext/canada/validators.py:369
msgid "Date format incorrect. Expecting YYYY-MM-DD"
msgstr ""

#: ckanext/canada/validators.py:350 ckanext/canada/validators.py:364
#: ckanext/canada/validators.py:383 ckanext/canada/validators.py:397
msgid "Must be a Unicode string value"
msgstr ""

#: ckanext/canada/validators.py:371 ckanext/canada/validators.py:382
#: ckanext/canada/validators.py:404 ckanext/canada/validators.py:415
msgid "Must be a JSON string"
msgstr ""

#: ckanext/canada/validators.py:378
#: ckanext/canada/validators.py:411
msgid "JSON object must contain \"en\" key"
msgstr ""

#: ckanext/canada/validators.py:380
#: ckanext/canada/validators.py:413
msgid "JSON object must contain \"fr\" key"
msgstr ""

#: ckanext/canada/validators.py:532
#: ckanext/canada/validators.py:565
#, python-format
msgid ""
"Cannot change value of registry_access field from '%s' to '%s'. This field is"
" read-only."
msgstr ""

#: ckanext/canada/validators.py:573
msgid "Invalid value for a digital object identifier."
msgstr ""

#: ckanext/canada/view.py:99
msgid "<strong>Note</strong><br>{0} is now logged in"
msgstr ""
Expand Down
40 changes: 22 additions & 18 deletions ckanext/canada/i18n/en/LC_MESSAGES/ckanext-canada.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: CKAN\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-06-25 17:26+0000\n"
"POT-Creation-Date: 2024-06-25 18:45+0000\n"
"PO-Revision-Date: 2014-01-23 13:04+0000\n"
"Last-Translator: Sean Hammond <sean.hammond@okfn.org>\n"
"Language: en\n"
Expand Down Expand Up @@ -263,12 +263,12 @@ msgstr ""
msgid "Suggestion Status"
msgstr ""

#: ckanext/canada/plugins.py:899
#: ckanext/canada/plugins.py:901
#: ckanext/canada/templates/public/package/snippets/resource_form.html:8
msgid "Previous"
msgstr ""

#: ckanext/canada/plugins.py:899
#: ckanext/canada/plugins.py:901
msgid "Next"
msgstr ""

Expand Down Expand Up @@ -556,75 +556,79 @@ msgstr ""
msgid "Open Government Portal (staging)"
msgstr ""

#: ckanext/canada/validators.py:118
#: ckanext/canada/validators.py:151
#, python-format
msgid "Tag \"%s\" length is less than minimum %s"
msgstr ""

#: ckanext/canada/validators.py:122
#: ckanext/canada/validators.py:155
#, python-format
msgid "Tag \"%s\" length is more than maximum %i"
msgstr ""

#: ckanext/canada/validators.py:126
#: ckanext/canada/validators.py:159
#, python-format
msgid "Tag \"%s\" may not contain consecutive spaces"
msgstr ""

#: ckanext/canada/validators.py:133
#: ckanext/canada/validators.py:166
#, python-format
msgid "Tag \"%s\" may not contain unprintable character U+%04x"
msgstr ""

#: ckanext/canada/validators.py:137
#: ckanext/canada/validators.py:170
#, python-format
msgid "Tag \"%s\" may not contain separator charater U+%04x"
msgstr ""

#: ckanext/canada/validators.py:153
#: ckanext/canada/validators.py:186
msgid "Badly formed hexadecimal UUID string"
msgstr ""

#: ckanext/canada/templates/internal/user/new_user_form.html:6
#: ckanext/canada/validators.py:165 ckanext/canada/validators.py:167
#: ckanext/canada/validators.py:198 ckanext/canada/validators.py:200
msgid "Please enter a valid email address."
msgstr ""

#: ckanext/canada/validators.py:182
#: ckanext/canada/validators.py:215
msgid "Invalid GeoJSON"
msgstr ""

#: ckanext/canada/validators.py:259
#: ckanext/canada/validators.py:292
msgid "Date may not be in the future when this record is marked ready to publish"
msgstr ""

#: ckanext/canada/validators.py:336
#: ckanext/canada/validators.py:369
msgid "Date format incorrect. Expecting YYYY-MM-DD"
msgstr ""

#: ckanext/canada/validators.py:350 ckanext/canada/validators.py:364
#: ckanext/canada/validators.py:383 ckanext/canada/validators.py:397
msgid "Must be a Unicode string value"
msgstr ""

#: ckanext/canada/validators.py:371 ckanext/canada/validators.py:382
#: ckanext/canada/validators.py:404 ckanext/canada/validators.py:415
msgid "Must be a JSON string"
msgstr ""

#: ckanext/canada/validators.py:378
#: ckanext/canada/validators.py:411
msgid "JSON object must contain \"en\" key"
msgstr ""

#: ckanext/canada/validators.py:380
#: ckanext/canada/validators.py:413
msgid "JSON object must contain \"fr\" key"
msgstr ""

#: ckanext/canada/validators.py:532
#: ckanext/canada/validators.py:565
#, python-format
msgid ""
"Cannot change value of registry_access field from '%s' to '%s'. This "
"field is read-only."
msgstr ""

#: ckanext/canada/validators.py:573
msgid "Invalid value for a digital object identifier."
msgstr ""

#: ckanext/canada/view.py:99
msgid "<strong>Note</strong><br>{0} is now logged in"
msgstr ""
Expand Down
40 changes: 22 additions & 18 deletions ckanext/canada/i18n/fr/LC_MESSAGES/ckanext-canada.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-06-25 17:26+0000\n"
"POT-Creation-Date: 2024-06-25 18:45+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: fr\n"
Expand Down Expand Up @@ -275,12 +275,12 @@ msgstr "Juridiction"
msgid "Suggestion Status"
msgstr "État de la suggestion"

#: ckanext/canada/plugins.py:899
#: ckanext/canada/plugins.py:901
#: ckanext/canada/templates/public/package/snippets/resource_form.html:8
msgid "Previous"
msgstr "Précédent"

#: ckanext/canada/plugins.py:899
#: ckanext/canada/plugins.py:901
msgid "Next"
msgstr "Suivant"

Expand Down Expand Up @@ -581,71 +581,71 @@ msgstr "Portail du gouvernement ouvert"
msgid "Open Government Portal (staging)"
msgstr "Portail du gouvernement ouvert (stadification)"

#: ckanext/canada/validators.py:118
#: ckanext/canada/validators.py:151
#, python-format
msgid "Tag \"%s\" length is less than minimum %s"
msgstr "La longueur de la balise \"%s\" est inférieure au minimum %s"

#: ckanext/canada/validators.py:122
#: ckanext/canada/validators.py:155
#, python-format
msgid "Tag \"%s\" length is more than maximum %i"
msgstr "La longueur de la balise \"%s\" est supérieure au maximum %i"

#: ckanext/canada/validators.py:126
#: ckanext/canada/validators.py:159
#, python-format
msgid "Tag \"%s\" may not contain consecutive spaces"
msgstr "La balise \"%s\" ne peut pas contenir d’espaces consécutifs"

#: ckanext/canada/validators.py:133
#: ckanext/canada/validators.py:166
#, python-format
msgid "Tag \"%s\" may not contain unprintable character U+%04x"
msgstr "La balise \"%s\" ne peut pas contenir de caractères non imprimables U+%04x"

#: ckanext/canada/validators.py:137
#: ckanext/canada/validators.py:170
#, python-format
msgid "Tag \"%s\" may not contain separator charater U+%04x"
msgstr "La balise \"%s\"ne peut pas contenir de caractères séparateurs U+%04x"

#: ckanext/canada/validators.py:153
#: ckanext/canada/validators.py:186
msgid "Badly formed hexadecimal UUID string"
msgstr "Chaîne UUID hexadécimale mal formée"

#: ckanext/canada/templates/internal/user/new_user_form.html:6
#: ckanext/canada/validators.py:165 ckanext/canada/validators.py:167
#: ckanext/canada/validators.py:198 ckanext/canada/validators.py:200
msgid "Please enter a valid email address."
msgstr "S’il vous plaît, mettez une adresse email valide."

#: ckanext/canada/validators.py:182
#: ckanext/canada/validators.py:215
msgid "Invalid GeoJSON"
msgstr "GeoJSON invalide"

#: ckanext/canada/validators.py:259
#: ckanext/canada/validators.py:292
msgid "Date may not be in the future when this record is marked ready to publish"
msgstr ""
"Une fois que ce document est marqué comme étant prêt à publier, la date "
"ne peut pas être dans le futur"

#: ckanext/canada/validators.py:336
#: ckanext/canada/validators.py:369
msgid "Date format incorrect. Expecting YYYY-MM-DD"
msgstr "Le format de la date est incorrect. Il devrait être AAAA-MM-JJ"

#: ckanext/canada/validators.py:350 ckanext/canada/validators.py:364
#: ckanext/canada/validators.py:383 ckanext/canada/validators.py:397
msgid "Must be a Unicode string value"
msgstr "Doit être une chaîne de caractères Unicode"

#: ckanext/canada/validators.py:371 ckanext/canada/validators.py:382
#: ckanext/canada/validators.py:404 ckanext/canada/validators.py:415
msgid "Must be a JSON string"
msgstr "Doit être une chaîne JSON"

#: ckanext/canada/validators.py:378
#: ckanext/canada/validators.py:411
msgid "JSON object must contain \"en\" key"
msgstr "L’objet JSON doit contenir la clé \"en\""

#: ckanext/canada/validators.py:380
#: ckanext/canada/validators.py:413
msgid "JSON object must contain \"fr\" key"
msgstr "L’objet JSON doit contenir la clé \"fr\""

#: ckanext/canada/validators.py:532
#: ckanext/canada/validators.py:565
#, python-format
msgid ""
"Cannot change value of registry_access field from '%s' to '%s'. This "
Expand All @@ -654,6 +654,10 @@ msgstr ""
"Impossible de modifier la valeur du champ d’accès au registre de '%s' à "
"'%s'. Ce champ ne sert qu’à des fins de lecture."

#: ckanext/canada/validators.py:573
msgid "Invalid value for a digital object identifier."
msgstr "Valeur non valide pour un identifiant d’objet numérique."

#: ckanext/canada/view.py:99
msgid "<strong>Note</strong><br>{0} is now logged in"
msgstr "<strong>Note</strong><br />{0} est maintenant connecté"
Expand Down
2 changes: 2 additions & 0 deletions ckanext/canada/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ def get_validators(self):
validators.canada_output_none,
'protect_registry_access':
validators.protect_registry_access,
'digital_object_identifier':
validators.digital_object_identifier,
}


Expand Down
9 changes: 5 additions & 4 deletions ckanext/canada/schemas/presets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2329,17 +2329,18 @@ presets:


# Field = Digital Object Identifier (DOI).
# {The Digital Object Identifier assigned to the dataset. For more information visit: http://cisti-icist.nrc-cnrc.gc.ca/eng/services/cisti/datacite-canada/index.html}
# {The Digital Object Identifier assigned to the dataset. For more information visit: https://support.datacite.org/docs/doi-basics}
- preset_name: canada_digital_object_identifier
values:
field_name: digital_object_identifier
label:
en: Digital Object Identifier (DOI)
fr: Identificateur d’objet numérique
help_text:
en: "The Digital Object Identifier assigned to the dataset. For more information visit: http://cisti-icist.nrc-cnrc.gc.ca/eng/services/cisti/datacite-canada/index.html"
fr: "L'identificateur d'objet numérique assigné au jeu de données. Pour obtenir de plus amples renseignements, veuillez consulter le site http://cisti-icist.nrc-cnrc.gc.ca/fra/services/icist/datacite-canada/index.html"
validators: scheming_required string_safe
en: "The Digital Object Identifier assigned to the dataset. For more information visit: https://support.datacite.org/docs/doi-basics"
fr: "L'identificateur d'objet numérique assigné au jeu de données. Pour obtenir de plus amples renseignements, veuillez consulter le site https://support.datacite.org/docs/doi-basics"
validators: scheming_required string_safe digital_object_identifier
display_snippet: doi.html

# Field = Jurisdiction.
# Default displayed value = Federal.
Expand Down
Loading
Loading