Skip to content

Commit

Permalink
Cover some more cases on is_flask
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Jun 10, 2016
1 parent 8bf303e commit 3ce78d0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ckan/common.py
Expand Up @@ -31,9 +31,16 @@ def is_flask():
Currently using the presence of `flask.request`, though we may want to
change that for something more robust.
'''
try:
pylons.request.environ
pylons_request_available = True
except TypeError:
pylons_request_available = False

if (flask.request and
(flask.request.environ.get('ckan.app') == 'flask_app' or
flask.request.environ.get('ckan.wsgiparty.setup'))):
flask.request.environ.get('ckan.wsgiparty.setup') or
not pylons_request_available)):
return True
else:
return False
Expand Down

0 comments on commit 3ce78d0

Please sign in to comment.