diff --git a/changes/8268.bugfix b/changes/8268.bugfix new file mode 100644 index 00000000000..0f835e9bc5b --- /dev/null +++ b/changes/8268.bugfix @@ -0,0 +1 @@ +Set license model `od_conformance` and `osd_conformance` attributes' default values to `False` to prevent errors. diff --git a/ckan/model/license.py b/ckan/model/license.py index edd8b3be6c1..6dd5af25c4c 100644 --- a/ckan/model/license.py +++ b/ckan/model/license.py @@ -18,6 +18,11 @@ class License(): """Domain object for a license.""" + default_values = { + 'od_conformance': False, + 'osd_conformance': False, + } + def __init__(self, data: dict[str, Any]) -> None: self._data = data for (key, value) in self._data.items(): @@ -31,6 +36,9 @@ def __init__(self, data: dict[str, Any]) -> None: self._data[key] = value elif isinstance(value, str): self._data[key] = value + for (key, value) in self.default_values.items(): + if key not in self._data: + self._data[key] = value def __getattr__(self, name: str) -> Any: try: