diff --git a/ckanapi/cli/dump.py b/ckanapi/cli/dump.py index f1c932c..b2d2d2b 100644 --- a/ckanapi/cli/dump.py +++ b/ckanapi/cli/dump.py @@ -194,7 +194,7 @@ def reply(error, record=None): populate_datastore_res_fields(ckan, res) if thing == 'datasets' and arguments['--resource-views']: for res in obj.get('resources', []): - populate_datastore_res_views(ckan, res) + populate_res_views(ckan, res) reply(None, obj) def _worker_command_line(thing, arguments): @@ -222,23 +222,20 @@ def b(name): ) -def populate_datastore_res_views(ckan, res): +def populate_res_views(ckan, res): """ update resource dict in-place with resource_view_list values - in every resource with datastore active using ckan - LocalCKAN/RemoteCKAN instance + in every resource with views using ckan LocalCKAN/RemoteCKAN instance """ - if not res.get('datastore_active', False): - return try: - ds = ckan.call_action('resource_view_list', { + views = ckan.call_action('resource_view_list', { 'id': res['id'], 'limit':0}) except CKANAPIError: return except NotFound: return # with localckan we'll get the real CKAN exception not a CKANAPIError subclass - if not ds: + if not views: return # return if the resource views list is empty - res['resource_views'] = ds + res['resource_views'] = views