Fix i18n messages in quantum.api.api_common

Change-Id: I30dc9ad76dbfb6cc038c283d81e449cf64d7ffec
This commit is contained in:
Zhongyue Luo 2013-01-21 09:56:13 +08:00
parent e91acd48ce
commit 0a1681cea8

View File

@ -45,15 +45,15 @@ class QuantumController(object):
data = body[self._resource_name] data = body[self._resource_name]
except KeyError: except KeyError:
# raise if _resource_name is not in req body. # raise if _resource_name is not in req body.
raise exc.HTTPBadRequest("Unable to find '%s' in request body" raise exc.HTTPBadRequest(_("Unable to find '%s' in request body") %
% self._resource_name) self._resource_name)
for param in params: for param in params:
param_name = param['param-name'] param_name = param['param-name']
param_value = data.get(param_name, None) param_value = data.get(param_name, None)
# If the parameter wasn't found and it was required, return 400 # If the parameter wasn't found and it was required, return 400
if param_value is None and param['required']: if param_value is None and param['required']:
msg = ("Failed to parse request. " + msg = (_("Failed to parse request. "
"Parameter: " + param_name + " not specified") "Parameter '%s' not specified") % param_name)
for line in msg.split('\n'): for line in msg.split('\n'):
LOG.error(line) LOG.error(line)
raise exc.HTTPBadRequest(msg) raise exc.HTTPBadRequest(msg)