diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d665e3b8fee4a31bb28ae49504bfc5819bf23cd..b38e083ceda38972130db959dde9e4e0aaf62241 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Corrected `_parse_distributions` of `ODSHDCATdeProfile` to not rely on resource dict, fixing missing `id` errors. +- Resolved an issue where harvested datasets were incorrectly required to have a category set, even when the configuration variable `ckanext.odsh.require_at_least_one_category` was set to false. ## [2.5.0] - 2025-01-30 diff --git a/ckanext/odsh/validation.py b/ckanext/odsh/validation.py index b49d3629bf07b6da3a6cae3c19c47c986ca8c7c1..186f40826cdddfc758f8cdb131ebeb56023ed46b 100644 --- a/ckanext/odsh/validation.py +++ b/ckanext/odsh/validation.py @@ -32,7 +32,7 @@ def validate_extra_groups(data, requireAtLeastOne, errors): log.debug("Validating extra_groups") value = _extract_value(data, 'groups') error_message_no_group = 'at least one group needed' - if value != None: + if value is not None: # 'value != None' means the extra key 'groups' was found, # so the dataset came from manual editing via the web-frontend. if not value: @@ -55,7 +55,7 @@ def validate_extra_groups(data, requireAtLeastOne, errors): data[('groups', num, 'id')] = group else: # no extra-field 'groups' # dataset might come from a harvest process - if not data.get(('groups', 0, 'id'), False) and \ + if requireAtLeastOne and not data.get(('groups', 0, 'id'), False) and \ not data.get(('groups', 0, 'name'), False): errors['groups'] = error_message_no_group