Skip to content

Commit

Permalink
[QOLDEV-986] disable CKAN 2.11 for now
Browse files Browse the repository at this point in the history
- Tests fail due to apparent problems with recognising the IResourceController implementation
  • Loading branch information
ThrawnCA committed Oct 30, 2024
1 parent 238d366 commit d61f3c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
strategy:
fail-fast: false
matrix:
ckan-version: ["2.11", "2.10", 2.9]
ckan-version: ["2.10", 2.9]
# 2.11 has problems with recognising the IResourceController interface
#ckan-version: ["2.11", "2.10", 2.9]

name: Test on CKAN ${{ matrix.ckan-version }}
runs-on: ubuntu-latest
Expand Down
13 changes: 7 additions & 6 deletions ckanext/resource_type_validation/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# encoding: utf-8

from ckan import plugins
from ckan.types import Any, Context

from .resource_type_validation import ResourceTypeValidator

Expand All @@ -20,19 +21,19 @@ def configure(self, config):
# IResourceController

# CKAN 2.9
def before_create(self, context, data_dict):
return self.before_resource_create(context, data_dict)
def before_create(self, context: Context, data_dict: dict[str, Any]):
self.before_resource_create(context, data_dict)

def before_update(self, context, existing_resource, data_dict):
return self.before_resource_update(context, existing_resource, data_dict)
def before_update(self, context: Context, current: dict[str, Any], data_dict: dict[str, Any]):
self.before_resource_update(context, current, data_dict)

# CKAN 2.10
def before_resource_create(self, context, data_dict):
def before_resource_create(self, context: Context, data_dict: dict[str, Any]):
""" Check that uploads have an acceptable mime type.
"""
self.validator.validate_resource_mimetype(data_dict)

def before_resource_update(self, context, existing_resource, data_dict):
def before_resource_update(self, context: Context, current: dict[str, Any], data_dict: dict[str, Any]):
""" Check that uploads have an acceptable mime type.
"""
self.validator.validate_resource_mimetype(data_dict)

0 comments on commit d61f3c8

Please sign in to comment.