feat: add customization

update d4science customization on 2.10 plugin
This commit is contained in:
Alessio Fabrizio 2024-12-11 15:42:55 +01:00
parent 856e36655b
commit bd6de2882a
2 changed files with 14 additions and 4 deletions

View File

@ -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:

View File

@ -15,7 +15,8 @@ e.g.
<h2 class="module-heading">
<i class="icon-medium icon-globe"></i>
{{ _('Filter by location') }}
<a href="{{ h.remove_url_param(['ext_bbox','ext_prev_extent', 'ext_location']) }}" class="action">{{ _('Clear') }}</a>
{# Changed by Francesco Mangiacrapa, added parameter alternative_url=alternative_url #}
<a href="{{ h.remove_url_param(['ext_bbox','ext_prev_extent', 'ext_location'], alternative_url=alternative_url) }}" class="action">{{ _('Clear') }}</a>
</h2>
{% set map_config = h.get_common_map_config() %}
<div class="dataset-map" data-module="spatial-query" data-default_extent="{{ default_extent }}" data-module-map_config="{{ h.dump_json(map_config) }}">
@ -26,5 +27,7 @@ e.g.
</div>
</section>
{% 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' %} #}