Skip to content

Commit

Permalink
Move spatial harvester customizations to separate plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bzar committed Nov 16, 2017
1 parent 30a230f commit 3103905
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ansible/roles/ckan/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ celery_user: "{{ www_user }}"

ckan_plugins_default: stats scheming_datasets fluent
# order matters, when templates call super()
ckan_plugins: harvest ckan_harvester hri_harvester dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface spatial_metadata spatial_query csw_harvester drupal7 datarequests report qa archiver ytp_organizations ytp_comments ytp_request ytp_report hierarchy_display ytp_theme ytp_drupal ytp_tasks ytp_dataset ytp_user ytp_service datastore showcase datapusher recline_grid_view recline_graph_view recline_map_view text_view image_view pdf_view geo_view geojson_view
ckan_plugins: harvest ckan_harvester hri_harvester dcat dcat_rdf_harvester dcat_json_harvester dcat_json_interface spatial_metadata spatial_query csw_harvester drupal7 datarequests report qa archiver ytp_organizations ytp_comments ytp_request ytp_report hierarchy_display ytp_theme ytp_drupal ytp_tasks ytp_dataset ytp_spatial ytp_user ytp_service datastore showcase datapusher recline_grid_view recline_graph_view recline_map_view text_view image_view pdf_view geo_view geojson_view


ckan_aws_plugins: cloudstorage
Expand Down
41 changes: 23 additions & 18 deletions modules/ckanext-ytp-main/ckanext/ytp/dataset/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ class YTPDatasetForm(plugins.SingletonPlugin, toolkit.DefaultDatasetForm):
plugins.implements(plugins.IPackageController, inherit=True)
plugins.implements(plugins.IActions)
plugins.implements(plugins.IConfigurable)
plugins.implements(ISpatialHarvester, inherit=True)
plugins.implements(plugins.IAuthFunctions)
plugins.implements(plugins.IValidators)

Expand Down Expand Up @@ -576,6 +575,29 @@ def before_index(self, pkg_dict):
def get_actions(self):
return {'package_show': action_package_show}



# IValidators
def get_validators(self):
return {
'lower_if_exists': validators.lower_if_exists,
'upper_if_exists': validators.upper_if_exists,
'tag_string_or_tags_required': validators.tag_string_or_tags_required,
'create_tags': validators.create_tags,
'create_fluent_tags': validators.create_fluent_tags,
'set_private_if_not_admin': validators.set_private_if_not_admin,
'list_to_string': validators.list_to_string,
'convert_to_list': validators.convert_to_list,
'tag_list_output': validators.tag_list_output,
'repeating_text': validators.repeating_text,
'repeating_text_output': validators.repeating_text_output,
'only_default_lang_required': validators.only_default_lang_required
}


class YTPSpatialHarvester(plugins.SingletonPlugin):
plugins.implements(ISpatialHarvester, inherit=True)

# ISpatialHarvester

def get_package_dict(self, context, data_dict):
Expand Down Expand Up @@ -690,20 +712,3 @@ def get_package_dict(self, context, data_dict):

return package_dict


# IValidators
def get_validators(self):
return {
'lower_if_exists': validators.lower_if_exists,
'upper_if_exists': validators.upper_if_exists,
'tag_string_or_tags_required': validators.tag_string_or_tags_required,
'create_tags': validators.create_tags,
'create_fluent_tags': validators.create_fluent_tags,
'set_private_if_not_admin': validators.set_private_if_not_admin,
'list_to_string': validators.list_to_string,
'convert_to_list': validators.convert_to_list,
'tag_list_output': validators.tag_list_output,
'repeating_text': validators.repeating_text,
'repeating_text_output': validators.repeating_text_output,
'only_default_lang_required': validators.only_default_lang_required
}
1 change: 1 addition & 0 deletions modules/ckanext-ytp-main/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
hri_harvester=ckanext.ytp.organizations.harvesters.hriharvester:HRIHarvester
ytp_theme=ckanext.ytp.theme.plugin:YtpThemePlugin
ytp_dataset=ckanext.ytp.dataset.plugin:YTPDatasetForm
ytp_spatial=ckanext.ytp.dataset.plugin:YTPSpatialHarvester
ytp_service=ckanext.ytp.service.plugin:YTPServiceForm
ytp_report=ckanext.ytp.report.plugin:YtpReportPlugin
Expand Down

0 comments on commit 3103905

Please sign in to comment.