Modify exception message style according to i18n guidelines

See link: http://docs.openstack.org/developer/oslo.i18n/guidelines.html
And description is:
Any message with more than one variable should use named interpolation
instead of positional, to allow translators to move the variables around
in the string to account for differences in grammar and writing direction.

Change-Id: I08ab7190176ac7117ae02980ad1e14e091fe99dc
This commit is contained in:
zhang.xiuhua
2016-06-11 16:42:17 +08:00
parent 7d931c534c
commit 171dbf0ec4
2 changed files with 12 additions and 5 deletions

View File

@@ -496,9 +496,13 @@ class FilterAction(BaseAction):
# in the __init__. However, the current workflow of DataTable
# and actions won't allow it. Need to be fixed in the future.
cls_name = self.__class__.__name__
raise NotImplementedError("You must define a %s method "
"for %s data type in %s." %
(func_name, data_type, cls_name))
raise NotImplementedError(
"You must define a %(func_name)s method for %(data_type)s"
" data type in %(cls_name)s."
% {'func_name': func_name,
'data_type': data_type,
'cls_name': cls_name})
_data = filter_func(table, data, filter_string)
self.assign_type_string(table, _data, data_type)
filtered_data.extend(_data)

View File

@@ -443,8 +443,11 @@ class TableTab(Tab):
data_func = getattr(self, func_name, None)
if data_func is None:
cls_name = self.__class__.__name__
raise NotImplementedError("You must define a %s method "
"on %s." % (func_name, cls_name))
raise NotImplementedError(
"You must define a %(func_name)s method on"
" %(cls_name)s."
% {'func_name': func_name, 'cls_name': cls_name})
# Load the data.
table.data = data_func()
table._meta.has_prev_data = self.has_prev_data(table)