From bd6de2882acdd39bab897b6cb40e7af490aed234 Mon Sep 17 00:00:00 2001 From: Alessio Fabrizio Date: Wed, 11 Dec 2024 15:42:55 +0100 Subject: [PATCH] feat: add customization update d4science customization on 2.10 plugin --- ckanext/spatial/harvesters/base.py | 9 ++++++++- .../templates/spatial/snippets/spatial_query.html | 9 ++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ckanext/spatial/harvesters/base.py b/ckanext/spatial/harvesters/base.py index 211a4e8..9140af8 100644 --- a/ckanext/spatial/harvesters/base.py +++ b/ckanext/spatial/harvesters/base.py @@ -222,7 +222,7 @@ class SpatialHarvester(HarvesterBase): if 'tags' in iso_values: do_clean = self.source_config.get('clean_tags') - tags_val = [munge_tag(tag) if do_clean else tag[:100] for tag in iso_values['tags']] + tags_val = [munge_tag(tag) if do_clean else tag[:100] for tag in iso_values['tags']] #this is not in d4science custom tags = [{'name': tag} for tag in tags_val] # Add default_tags from config @@ -622,6 +622,12 @@ class SpatialHarvester(HarvesterBase): try: package_id = p.toolkit.get_action('package_create')(context, package_dict) log.info('Created new package %s with guid %s', package_id, harvest_object.guid) + + #d4science check serchable + package_dict = check_searchable(package_dict) + new_package = p.toolkit.get_action('package_update')(context, package_dict) + log.info('Forced package update for adding searchable = True at %s with guid %s', package_id, harvest_object.guid) + except p.toolkit.ValidationError as e: self._save_object_error('Validation Error: %s' % six.text_type(e.error_summary), harvest_object, 'Import') return False @@ -666,6 +672,7 @@ class SpatialHarvester(HarvesterBase): package_dict['id'] = harvest_object.package_id try: + package_dict = check_searchable(package_dict) #added package_id = p.toolkit.get_action('package_update')(context, package_dict) log.info('Updated package %s with guid %s', package_id, harvest_object.guid) except p.toolkit.ValidationError as e: diff --git a/ckanext/spatial/templates/spatial/snippets/spatial_query.html b/ckanext/spatial/templates/spatial/snippets/spatial_query.html index 90f8ce2..0540e42 100644 --- a/ckanext/spatial/templates/spatial/snippets/spatial_query.html +++ b/ckanext/spatial/templates/spatial/snippets/spatial_query.html @@ -15,7 +15,8 @@ e.g.

{{ _('Filter by location') }} - {{ _('Clear') }} + {# Changed by Francesco Mangiacrapa, added parameter alternative_url=alternative_url #} + {{ _('Clear') }}

{% set map_config = h.get_common_map_config() %}
@@ -26,5 +27,7 @@ e.g.
-{% set type = 'asset' if h.ckan_version().split('.')[1] | int >= 9 else 'resource' %} -{% include 'spatial/snippets/spatial_query_' ~ type ~ '.html' %} +{# prima riga d4science, le altre due spatial #} +{# {% resource 'ckanext-spatial/spatial_query' %} #} +{# {% set type = 'asset' if h.ckan_version().split('.')[1] | int >= 9 else 'resource' %} #} +{# {% include 'spatial/snippets/spatial_query_' ~ type ~ '.html' %} #}