Skip to content

Commit

Permalink
ref: migrate ckan imports to function code
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jan 24, 2024
1 parent 4df0801 commit bd2da9f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.6.1
- ref: migrate ckan imports to function code so dcor_control
works on any machine
0.6.0
- BREAKING CHANGE: wait_for_resource now requires the resource_id
instead of the resource path
Expand Down
3 changes: 1 addition & 2 deletions dcor_shared/ckan.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import pathlib

from ckan import common as ckan_common

from .parse import get_ini_config_option


Expand All @@ -13,6 +11,7 @@ def get_ckan_config_option(option):
taken from there. Else, the configuration is taken from the
configuration file returned by :func:`get_ckan_config_path`.
"""
from ckan import common as ckan_common
if ckan_common.config:
# Get from current configuration (The `get` method in CKAN 2.10
# returns default values if not placeholder is specified)
Expand Down
6 changes: 3 additions & 3 deletions dcor_shared/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import time
import warnings

from ckan.common import config
from ckan import logic

from .ckan import get_resource_path


Expand Down Expand Up @@ -46,6 +43,9 @@ def wait_for_resource(resource_id: str,
is called, so we only check for the existence of the resource
in ckan and whether the `s3_available` attribute is defined.
"""
from ckan.common import config
from ckan import logic

if len(resource_id) != 36:
warnings.warn("Please pass the CKAN resource id as `resource_id` "
"instead of a string or a path. This will raise an "
Expand Down
3 changes: 0 additions & 3 deletions dcor_shared/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
from .parse import get_ini_config_option


from ckan.common import config as ckan_config # noqa: F401


def get_dcor_depot_path():
return pathlib.Path(get_ckan_config_option(
"ckanext.dcor_depot.depots_path"))
Expand Down

0 comments on commit bd2da9f

Please sign in to comment.