Skip to content

Commit

Permalink
Refactor the SchemingDCATHarvester to use the configuration defaults …
Browse files Browse the repository at this point in the history
…as fallback
  • Loading branch information
mjanez committed Oct 17, 2024
1 parent 045f164 commit 1918b6a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ckanext/schemingdcat/harvesters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1455,9 +1455,6 @@ def _set_package_dict_default_values(self, package_dict, harvest_object, context
local_org = source_package_dict.get("owner_org")
package_dict["owner_org"] = local_org

# Using dataset config defaults
package_dict = self._apply_package_defaults_from_config(package_dict, DATASET_DEFAULT_FIELDS)

# Add default_extras from config
default_extras = self.config.get('default_extras',{})
if default_extras:
Expand Down Expand Up @@ -1530,6 +1527,10 @@ def _set_package_dict_default_values(self, package_dict, harvest_object, context
elif isinstance(value, dict):
package_dict[key] = {k: v for k, v in value.items()}


# Fallback: Using schemingdcat config defaults if no default values are set
package_dict = self._apply_package_defaults_from_config(package_dict, DATASET_DEFAULT_FIELDS)

# log.debug('package_dict default values: %s', package_dict)
return package_dict

Expand Down

0 comments on commit 1918b6a

Please sign in to comment.