Skip to content

Commit

Permalink
[#2977] Import config from ckan.common instead of pylons.
Browse files Browse the repository at this point in the history
  • Loading branch information
torfsen committed Sep 14, 2016
1 parent c3cf34e commit a967a9b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ckan/lib/jobs.py
Expand Up @@ -20,14 +20,14 @@

import logging

from pylons import config
import rq
from rq.connections import push_connection
from rq.exceptions import NoSuchJobError
from rq.job import Job
from rq.utils import ensure_list

from ckan.lib.redis import connect_to_redis
from ckan.common import config


log = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion ckan/lib/redis.py
Expand Up @@ -11,9 +11,10 @@
import datetime
import logging

from pylons import config
from redis import ConnectionPool, Redis

from ckan.common import config


log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/lib/test_cli.py
Expand Up @@ -10,12 +10,12 @@

from nose.tools import (assert_raises, eq_ as eq, ok_ as ok, assert_in,
assert_not_in, assert_not_equal as neq, assert_false as nok)
from pylons import config
from paste.script.command import run

import ckan.lib.cli as cli
import ckan.lib.jobs as jobs
import ckan.tests.helpers as helpers
from ckan.common import config

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/lib/test_jobs.py
Expand Up @@ -7,11 +7,11 @@
import datetime

from nose.tools import ok_, assert_equal, raises
from pylons import config
import rq

import ckan.lib.jobs as jobs
from ckan.tests.helpers import changed_config, recorded_logs, RQTestBase
from ckan.common import config


class TestQueueNamePrefixes(RQTestBase):
Expand Down
8 changes: 7 additions & 1 deletion doc/extensions/best-practices.rst
Expand Up @@ -87,7 +87,13 @@ the CKAN site ID, which is available via

::

from pylons import config
try:
# CKAN 2.7 and later
from ckan.common import config
except ImportError:
# CKAN 2.6 and earlier
from pylons import config

site_id = config[u'ckan.site_id']

Currently this only affects the :ref:`Redis database <ckan_redis_url>`:
Expand Down

0 comments on commit a967a9b

Please sign in to comment.