Skip to content

Commit

Permalink
fix for mappings lookup, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hanke committed Sep 12, 2024
1 parent 7556f1d commit 48f361f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 33 deletions.
15 changes: 12 additions & 3 deletions ckanext/csvwmapandtransform/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,23 @@ def __init__(self, **kwargs):


def csvwmapandtransform_find_mappings(context: Context, data_dict):
groups = [entry.name for entry in toolkit.get_action("group_list")({}, {"all_fields": True})]
if MAPPING_GROUP in groups:
mapping_group_id = next(
(
entry["id"] if entry["title"] == MAPPING_GROUP else None
for entry in toolkit.get_action("group_list")({}, {"all_fields": True})
),
None,
)
# log.info(f"groups=={groups}")
if mapping_group_id:
mapping_group = toolkit.get_action("group_show")(
{}, {"id": MAPPING_GROUP, "include_datasets": True}
{"ignore_auth": True}, {"id": mapping_group_id, "include_datasets": True}
)
else:
mapping_group = create_group(MAPPING_GROUP)
packages = mapping_group.get("packages", None)
log.info(f"mappings=={packages}")

if packages:
packages = [
toolkit.get_action("package_show")({}, {"id": package["id"]})
Expand Down
10 changes: 0 additions & 10 deletions ckanext/csvwmapandtransform/assets/script.js

This file was deleted.

5 changes: 0 additions & 5 deletions ckanext/csvwmapandtransform/assets/style.css

This file was deleted.

14 changes: 0 additions & 14 deletions ckanext/csvwmapandtransform/assets/webassets.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ckanext/csvwmapandtransform/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def notify(self, resource: model.Resource):

# IResourceController

if not toolkit.check_ckan_version("2.10"):
if not toolkit.check_ckan_version("2.10") or toolkit.check_ckan_version("2.11"):

def after_create(self, context, resource_dict):
self.after_resource_create(context, resource_dict)
Expand Down

0 comments on commit 48f361f

Please sign in to comment.