Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
florianm committed Aug 4, 2017
2 parents 22227e2 + cafcfbd commit a3bd2a5
Show file tree
Hide file tree
Showing 178 changed files with 163,936 additions and 148,864 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -26,6 +26,7 @@ fl_notes.txt
.noseids
*~
.idea
.vscode

# custom style
ckan/public/base/less/custom.less
Expand Down
15 changes: 13 additions & 2 deletions ckan/config/middleware/__init__.py
Expand Up @@ -2,14 +2,16 @@

"""WSGI app initialization"""
import urllib
import urlparse

import webob
from routes import request_config as routes_request_config

from ckan.lib.i18n import get_locales_from_config
from ckan.config.environment import load_environment
from ckan.config.middleware.flask_app import make_flask_stack
from ckan.config.middleware.pylons_app import make_pylons_stack
from ckan.common import config
from ckan.lib.i18n import get_locales_from_config

import logging
log = logging.getLogger(__name__)
Expand Down Expand Up @@ -177,12 +179,21 @@ def __call__(self, environ, start_response):
log.debug('Serving request via {0} app'.format(app_name))
environ['ckan.app'] = app_name
if app_name == 'flask_app':
# This request will be served by Flask, but we still need the
# Pylons URL builder (Routes) to work
parts = urlparse.urlparse(config.get('ckan.site_url',
'http://0.0.0.0:5000'))
request_config = routes_request_config()
request_config.host = str(parts.netloc + parts.path)
request_config.protocol = str(parts.scheme)
request_config.mapper = config['routes.map']

return self.apps[app_name](environ, start_response)
else:
# Although this request will be served by Pylons we still
# need an application context in order for the Flask URL
# builder to work and to be able to access the Flask config
flask_app = self.apps['flask_app']._wsgi_app

with flask_app.app_context():
with flask_app.test_request_context():
return self.apps[app_name](environ, start_response)
1 change: 0 additions & 1 deletion ckan/config/middleware/flask_app.py
Expand Up @@ -154,7 +154,6 @@ def hello_world_post():
app.register_extension_blueprint(plugin.get_blueprint())

# Start other middleware

for plugin in PluginImplementations(IMiddleware):
app = plugin.make_middleware(app, config)

Expand Down
Binary file modified ckan/i18n/ar/LC_MESSAGES/ckan.mo
Binary file not shown.

0 comments on commit a3bd2a5

Please sign in to comment.