Skip to content

Commit

Permalink
Merge branch 'master' into 3196-common-url_for
Browse files Browse the repository at this point in the history
Conflicts:
	ckan/plugins/interfaces.py
  • Loading branch information
amercader committed Sep 28, 2016
2 parents 614a116 + a540864 commit 1732d1c
Show file tree
Hide file tree
Showing 12 changed files with 341 additions and 237 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
2 changes: 1 addition & 1 deletion ckan/config/resource_formats.json
Expand Up @@ -69,7 +69,7 @@
["TAR", "TAR Compressed File", "application/x-tar", []],
["PNG", "PNG Image File", "image/png", []],
["RSS", "RSS feed", "application/rss+xml", []],
["GeoJSON", "Geographic JavaScript Object Notation", null, []],
["GeoJSON", "Geographic JavaScript Object Notation", "application/geo+json", ["geojson"]],
["SHP", "Shapefile", null, ["esri shapefile"]],
["TORRENT", "Torrent", "application/x-bittorrent", ["bittorrent"]],
["ICS", "iCalendar", "text/calendar", ["ifb", "iCal"]],
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 1732d1c

Please sign in to comment.