Merge "Adds Missing _() for Exception Message Translation"

This commit is contained in:
Jenkins 2014-01-17 10:54:58 +00:00 committed by Gerrit Code Review
commit 64c00dd540
2 changed files with 8 additions and 6 deletions

View File

@ -350,8 +350,10 @@ class MySqlAdmin(object):
try: try:
user.name = username # Could possibly throw a BadRequest here. user.name = username # Could possibly throw a BadRequest here.
except exceptions.ValueError as ve: except exceptions.ValueError as ve:
raise exception.BadRequest("Username %s is not valid: %s" raise exception.BadRequest(_("Username %(user)s is not valid"
% (username, ve.message)) ": %(reason)s") %
{'user': username, 'reason': ve.message}
)
with LocalSqlClient(get_engine()) as client: with LocalSqlClient(get_engine()) as client:
q = sql_query.Query() q = sql_query.Query()
q.columns = ['User', 'Host', 'Password'] q.columns = ['User', 'Host', 'Password']

View File

@ -560,13 +560,13 @@ class Instance(BuiltInstance):
self.validate_can_perform_action() self.validate_can_perform_action()
LOG.info("Resizing volume of instance %s..." % self.id) LOG.info("Resizing volume of instance %s..." % self.id)
if not self.volume_size: if not self.volume_size:
raise exception.BadRequest("Instance %s has no volume." raise exception.BadRequest(_("Instance %s has no volume.")
% self.id) % self.id)
old_size = self.volume_size old_size = self.volume_size
if int(new_size) <= old_size: if int(new_size) <= old_size:
msg = ("The new volume 'size' must be larger than the current " raise exception.BadRequest(_("The new volume 'size' must be "
"volume size of '%s'") "larger than the current volume "
raise exception.BadRequest(msg % old_size) "size of '%s'") % old_size)
# Set the task to Resizing before sending off to the taskmanager # Set the task to Resizing before sending off to the taskmanager
self.update_db(task_status=InstanceTasks.RESIZING) self.update_db(task_status=InstanceTasks.RESIZING)
task_api.API(self.context).resize_volume(new_size, self.id) task_api.API(self.context).resize_volume(new_size, self.id)