Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions ckanext/datastore_refresh/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging

import ckan.plugins.toolkit as tk
from ckanext.datavicmain.helpers import datavic_is_datapusher_plus_format
import click


Expand Down Expand Up @@ -65,16 +66,13 @@ def dataset(frequency):

def _submit_resource(dataset, resource, context):
"""resource: resource dictionary"""
# Copied and modifed from ckan/default/src/ckanext-xloader/ckanext/xloader/cli.py to check for Xloader formats before submitting
# import here, so that that loggers are setup
from ckanext.xloader.plugin import XLoaderFormats

if not XLoaderFormats.is_it_an_xloader_format(resource["format"]):
if not datavic_is_datapusher_plus_format(resource["format"]):
click.echo(
f'Skipping resource {resource["id"]} because format'
f' "{resource["format"]}" is not configured to be xloadered'
f'Skipping resource {resource["id"]} because format "{resource["format"]}" '
f'is not configured for datapusher_plus'
)
return

if resource["url_type"] in ("datapusher", "xloader"):
click.echo(
f'Skipping resource {resource["id"]} because url_type'
Expand All @@ -93,7 +91,7 @@ def _submit_resource(dataset, resource, context):
"ignore_hash": False,
}

success = tk.get_action("xloader_submit")(context, data_dict)
success = tk.get_action("datapusher_submit")(context, data_dict)
if success:
click.secho("...ok", fg="green")
tk.get_action("datastore_refresh_dataset_refresh_update")(
Expand Down
6 changes: 3 additions & 3 deletions ckanext/datastore_refresh/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import ckan.plugins.toolkit as tk
from ckan.views.api import API_DEFAULT_VERSION

import ckanext.xloader.interfaces as xloader_interfaces
import ckanext.datapusher_plus.interfaces as datapusher_plus_interfaces

from . import cli, helpers, view
from .logic import auth, action
Expand All @@ -22,7 +22,7 @@ class DatastoreRefreshPlugin(plugins.SingletonPlugin):
plugins.implements(plugins.IConfigurer)
plugins.implements(plugins.IClick)
plugins.implements(plugins.IBlueprint)
plugins.implements(xloader_interfaces.IXloader, inherit=True)
plugins.implements(datapusher_plus_interfaces.IDataPusher, inherit=True)

# ITemplateHelpers
def get_helpers(self):
Expand All @@ -49,7 +49,7 @@ def get_commands(self):
def get_blueprint(self):
return view.get_blueprints()

# IXLoader
# IDataPusher
def after_upload(self, context, resource_dict, dataset_dict):
_purge_section_cache(context, resource_dict, dataset_dict)

Expand Down