Files
RobustToolbox/Schemas/rga_validators.py
B3CKDOOR 76134e0f8d Adding "Attribution-NonCommercial-NoDerivatives 4.0 International" (#6008)
* Adding "Attribution-NonCommercial-NoDerivatives 4.0 International"

Adding the "Attribution-NonCommercial-NoDerivatives 4.0 International" License type, this is getting marked as an "invalid" license when its actually a valid license.

[License link](https://creativecommons.org/licenses/by-nc-nd/4.0/)

* Darn, forgot a comma
2025-06-09 20:57:54 +02:00

32 lines
812 B
Python

from yamale.validators import Validator
import validators
class License(Validator):
tag = "license"
licenses = [
"CC-BY-3.0",
"CC-BY-4.0",
"CC-BY-SA-3.0",
"CC-BY-SA-4.0",
"CC-BY-NC-3.0",
"CC-BY-NC-4.0",
"CC-BY-NC-SA-3.0",
"CC-BY-NC-SA-4.0",
"CC-BY-ND-3.0",
"CC-BY-ND-4.0",
"CC-BY-NC-ND-4.0",
"CC0-1.0",
"MIT",
"Custom" # implies that the license is described in the copyright field.
]
def _is_valid(self, value):
return value in self.licenses
class Url(Validator):
tag = "url"
def _is_valid(self, value):
# Source field is required to ensure its not neglected, but there may be no applicable URL
return (value == "NA") or validators.url(value)