Skip to content

Commit

Permalink
types import for Context is now ckan version sensitiv
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hanke committed Mar 14, 2024
1 parent 389fee5 commit 3e7e17c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ckanext/csvwmapandtransform/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from ckan import model

if toolkit.check_ckan_version("2.10"):
from ckan.types import Context
else:

class Context(dict):
def __init__(self, **kwargs):
super().__init__(**kwargs)


from ckan.lib.plugins import DefaultTranslation
from ckan.types import Context

from typing import Any

from ckanext.csvwmapandtransform import action, helpers, auth, views
Expand Down Expand Up @@ -47,7 +57,7 @@ def update_config(self, config_):
# IResourceUrlChange

def notify(self, resource: model.Resource):
context: Context = {"ignore_auth": True}
context: {"ignore_auth": True}
resource_dict = toolkit.get_action("resource_show")(
context,
{
Expand All @@ -66,10 +76,10 @@ def after_create(self, context, resource_dict):
# def before_show(self, resource_dict):
# self.before_resource_show(resource_dict)

def after_update(self, context: Context, resource_dict: dict[str, Any]):
def after_update(self, context, resource_dict: dict[str, Any]):
self._sumbit_transform(resource_dict)

def after_resource_create(self, context: Context, resource_dict: dict[str, Any]):
def after_resource_create(self, context, resource_dict: dict[str, Any]):
self._sumbit_transform(resource_dict)

def _sumbit_transform(self, resource_dict: dict[str, Any]):
Expand Down

0 comments on commit 3e7e17c

Please sign in to comment.