Skip to content

Commit

Permalink
Merge pull request ckan#8268 from JVickery-TBS/fix/license-attribute-…
Browse files Browse the repository at this point in the history
…errors

Default Licenses to "Not Open"
  • Loading branch information
amercader authored Jun 18, 2024
2 parents 28f7cf1 + ba84766 commit 0628ead
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes/8268.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set license model `od_conformance` and `osd_conformance` attributes' default values to `False` to prevent errors.
8 changes: 8 additions & 0 deletions ckan/model/license.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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:
Expand Down

0 comments on commit 0628ead

Please sign in to comment.