Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ckan/ckan into override-feed-class
Browse files Browse the repository at this point in the history
Conflicts:
	ckan/plugins/interfaces.py
  • Loading branch information
martinburchell committed Sep 26, 2016
2 parents 28a3e2f + a540864 commit 22dda1d
Show file tree
Hide file tree
Showing 8 changed files with 334 additions and 230 deletions.
14 changes: 3 additions & 11 deletions ckan/config/environment.py
Expand Up @@ -251,17 +251,9 @@ def update_config():
# CONFIGURATION OPTIONS HERE (note: all config options will override
# any Pylons config options)

# for postgresql we want to enforce utf-8
sqlalchemy_url = config.get('sqlalchemy.url', '')
if sqlalchemy_url.startswith('postgresql://'):
extras = {'client_encoding': 'utf8'}
else:
extras = {}

engine = sqlalchemy.engine_from_config(config, 'sqlalchemy.', **extras)

if not model.meta.engine:
model.init_model(engine)
# Initialize SQLAlchemy
engine = sqlalchemy.engine_from_config(config, client_encoding='utf8')
model.init_model(engine)

for plugin in p.PluginImplementations(p.IConfigurable):
plugin.configure(config)
Expand Down
7 changes: 7 additions & 0 deletions ckan/lib/jobs.py
Expand Up @@ -28,6 +28,7 @@

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


log = logging.getLogger(__name__)
Expand Down Expand Up @@ -249,3 +250,9 @@ def handle_exception(self, job, *exc_info):
log.exception(u'Job {} on worker {} raised an exception: {}'.format(
job.id, self.key, exc_info[1]))
return super(Worker, self).handle_exception(job, *exc_info)

def main_work_horse(self, job, queue):
# This method is called in a worker's work horse process right
# after forking.
load_environment(config[u'global_conf'], config)
return super(Worker, self).main_work_horse(job, queue)

0 comments on commit 22dda1d

Please sign in to comment.