Merge "Ensure status code is always passed as int"

This commit is contained in:
Jenkins 2016-07-08 23:52:02 +00:00 committed by Gerrit Code Review
commit 99344c4644
3 changed files with 9 additions and 9 deletions

View File

@ -766,7 +766,7 @@ def render_response(body=None, status=None, headers=None, method=None):
headers = _convert_to_str(headers)
resp = webob.Response(body=body,
status='%s %s' % status,
status='%d %s' % status,
headerlist=headers)
if method and method.upper() == 'HEAD':

View File

@ -95,7 +95,7 @@ class IdentityProvider(_ControllerBase):
identity_provider.setdefault('enabled', False)
idp_ref = self.federation_api.create_idp(idp_id, identity_provider)
response = IdentityProvider.wrap_member(request.context_dict, idp_ref)
return wsgi.render_response(body=response, status=('201', 'Created'))
return wsgi.render_response(body=response, status=(201, 'Created'))
@controller.filterprotected('id', 'enabled')
def list_identity_providers(self, request, filters):
@ -183,7 +183,7 @@ class FederationProtocol(_ControllerBase):
ref = self._normalize_dict(protocol)
ref = self.federation_api.create_protocol(idp_id, protocol_id, ref)
response = FederationProtocol.wrap_member(request.context_dict, ref)
return wsgi.render_response(body=response, status=('201', 'Created'))
return wsgi.render_response(body=response, status=(201, 'Created'))
@controller.protected()
@validation.validated(schema.protocol_update, 'protocol')
@ -222,7 +222,7 @@ class MappingController(_ControllerBase):
mapping_ref = self.federation_api.create_mapping(mapping_id, ref)
response = MappingController.wrap_member(request.context_dict,
mapping_ref)
return wsgi.render_response(body=response, status=('201', 'Created'))
return wsgi.render_response(body=response, status=(201, 'Created'))
@controller.protected()
def list_mappings(self, request):
@ -395,7 +395,7 @@ class Auth(auth_controllers.Auth):
headers = self._build_response_headers(service_provider)
return wsgi.render_response(body=response.to_string(),
status=('200', 'OK'),
status=(200, 'OK'),
headers=headers)
@validation.validated(schema.saml_create, 'auth')
@ -415,7 +415,7 @@ class Auth(auth_controllers.Auth):
headers = self._build_response_headers(service_provider)
return wsgi.render_response(body=ecp_assertion.to_string(),
status=('200', 'OK'),
status=(200, 'OK'),
headers=headers)
@ -491,7 +491,7 @@ class ServiceProvider(_ControllerBase):
CONF.saml.relay_state_prefix)
sp_ref = self.federation_api.create_sp(sp_id, service_provider)
response = ServiceProvider.wrap_member(request.context_dict, sp_ref)
return wsgi.render_response(body=response, status=('201', 'Created'))
return wsgi.render_response(body=response, status=(201, 'Created'))
@controller.filterprotected('id', 'enabled')
def list_service_providers(self, request, filters):
@ -529,5 +529,5 @@ class SAMLMetadataV3(_ControllerBase):
except IOError as e:
# Raise HTTP 500 in case Metadata file cannot be read.
raise exception.MetadataFileError(reason=e)
return wsgi.render_response(body=metadata, status=('200', 'OK'),
return wsgi.render_response(body=metadata, status=(200, 'OK'),
headers=[('Content-Type', 'text/xml')])

View File

@ -189,7 +189,7 @@ class DomainConfigV3(controller.V3Controller):
return wsgi.render_response(body={self.member_name: ref})
else:
return wsgi.render_response(body={self.member_name: ref},
status=('201', 'Created'))
status=(201, 'Created'))
@controller.protected()
def get_domain_config(self, request, domain_id, group=None, option=None):