def __call__(self, env, start_response): # Inspect the request for mime type and API version env = normalize_accept_header(env) env = normalize_path_prefix(env) env = normalize_path_suffix(env) env['PATH_INFO'] = normalize_starting_slash(env.get('PATH_INFO')) env['PATH_INFO'] = normalize_trailing_slash(env['PATH_INFO']) # Fall back on defaults, if necessary env['KEYSTONE_RESPONSE_ENCODING'] = env.get( 'KEYSTONE_RESPONSE_ENCODING') or DEFAULT_RESPONSE_ENCODING env['HTTP_ACCEPT'] = 'application/' + (env.get( 'KEYSTONE_RESPONSE_ENCODING') or DEFAULT_RESPONSE_ENCODING) if 'KEYSTONE_API_VERSION' not in env: # Version was not specified in path or headers # return multiple choice unless the version controller can handle # this request if env['PATH_INFO'] not in ['/', '']: logger.debug("Call without a version - returning 300. Path=%s" % env.get('PATH_INFO', '')) from keystone.controllers.version import VersionController controller = VersionController(options=None) response = controller.get_multiple_choice(req=Request(env), file='multiple_choice') return response(env, start_response) return self.app(env, start_response)
def __call__(self, env, start_response): # Inspect the request for mime type and API version env = normalize_accept_header(env) env = normalize_path_prefix(env) env = normalize_path_suffix(env) env['PATH_INFO'] = normalize_starting_slash(env.get('PATH_INFO')) env['PATH_INFO'] = normalize_trailing_slash(env['PATH_INFO']) # Fall back on defaults, if necessary env['KEYSTONE_RESPONSE_ENCODING'] = env.get( 'KEYSTONE_RESPONSE_ENCODING') or DEFAULT_RESPONSE_ENCODING env['HTTP_ACCEPT'] = 'application/' + ( env.get('KEYSTONE_RESPONSE_ENCODING') or DEFAULT_RESPONSE_ENCODING) if 'KEYSTONE_API_VERSION' not in env: # Version was not specified in path or headers # return multiple choice unless the version controller can handle # this request if env['PATH_INFO'] not in ['/', '']: from keystone.controllers.version import VersionController controller = VersionController(options=None) response = controller.get_multiple_choice( req=Request(env), file='multiple_choice') return response(env, start_response) return self.app(env, start_response)
def __call__(self, env, start_response): # Inspect the request for mime type and API version env = normalize_accept_header(env) env = normalize_path_prefix(env) env = normalize_path_suffix(env) env["PATH_INFO"] = normalize_starting_slash(env.get("PATH_INFO")) env["PATH_INFO"] = normalize_trailing_slash(env["PATH_INFO"]) # Fall back on defaults, if necessary env["KEYSTONE_RESPONSE_ENCODING"] = env.get("KEYSTONE_RESPONSE_ENCODING") or DEFAULT_RESPONSE_ENCODING env["HTTP_ACCEPT"] = "application/" + (env.get("KEYSTONE_RESPONSE_ENCODING") or DEFAULT_RESPONSE_ENCODING) if "KEYSTONE_API_VERSION" not in env: # Version was not specified in path or headers # return multiple choice unless the version controller can handle # this request if env["PATH_INFO"] not in ["/", ""]: from keystone.controllers.version import VersionController controller = VersionController(options=None) response = controller.get_multiple_choice(req=Request(env), file="multiple_choice") return response(env, start_response) return self.app(env, start_response)