def is_flask_request():
 try:
  pylons.request.environ
  pylons_request_available = True
 except TypeError:
  pylons_request_available = False
 return (flask.request and ((flask.request.environ.get(u'ckan.app') == u'flask_app') or (not pylons_request_available)))

def is_flask_request ( ) : try : pylons . request . environ pylons_request_available = True except TypeError : pylons_request_available = False return ( flask . request and ( ( flask . request . environ . get ( u'ckan.app' ) == u'flask_app' ) or ( not pylons_request_available ) ) )
a centralized way to determine whether we are in the context of a request being served by flask or pylons .