Skip to content

Commit

Permalink
ref: migration to CKAN 2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Aug 17, 2023
1 parent 2c81608 commit c75da4c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.7.0
- ref: migration to CKAN 2.10.1
0.6.10
- maintenance release
0.6.9
Expand Down
2 changes: 1 addition & 1 deletion ckanext/dc_view/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def update_config(self, config):
plugins.toolkit.add_resource('assets', 'dc_view')

# IResourceController
def after_create(self, context, resource):
def after_resource_create(self, context, resource):
"""Generate preview data"""
if resource.get('mimetype') in DC_MIME_TYPES:
pkg_job_id = f"{resource['package_id']}_{resource['position']}_"
Expand Down
4 changes: 3 additions & 1 deletion ckanext/dc_view/tests/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def synchronous_enqueue_job(job_func, args=None, kwargs=None, title=None,
def test_create_preview_job(enqueue_job_mock, create_with_upload, monkeypatch,
ckan_config, tmpdir):
monkeypatch.setitem(ckan_config, 'ckan.storage_path', str(tmpdir))
monkeypatch.setattr(ckan.lib.uploader, '_storage_path', str(tmpdir))
monkeypatch.setattr(ckan.lib.uploader,
'get_storage_path',
lambda: str(tmpdir))

user = factories.User()
owner_org = factories.Organization(users=[{
Expand Down
18 changes: 16 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from setuptools import setup, find_packages
from codecs import open # To use a consistent encoding
import sys
import warnings

author = "Paul Müller"
authors = [author]
Expand All @@ -12,6 +13,19 @@
sys.path.insert(0, realpath(dirname(__file__))+"/" + "/".join(name.split("-")))
from _version import version # noqa: E402

try:
# Make sure this fails for old CKAN versions
import ckan
ckan_version = [int(v) for v in ckan.__version__.split(".")]
if ckan_version < [2, 10, 1]:
raise ValueError(
f"Your CKAN version {ckan_version} is not supported! If you "
f"are still on CKAN 2.9.5, then the following package versions "
f"are supported:"
f"\n ckanext-dc_view<=0.6.10"
)
except ImportError:
warnings.warn("CKAN not installed, supported version check skipped.")

setup(
name=name,
Expand All @@ -28,8 +42,8 @@
namespace_packages=['ckanext'],
install_requires=[
# the "ckan" dependency is implied
"dclab>=0.27.11",
"dcor_shared>=0.2.0",
"dclab>=0.52.0",
"dcor_shared>0.3.1",
"matplotlib",
"numpy>=1.19",
"pillow",
Expand Down

0 comments on commit c75da4c

Please sign in to comment.