Avoid Forcing the Translation of Translatable Variables

Whenever possible translation should not be forced by use of six.text_type()
on a message being used with a format string.

http://docs.openstack.org/developer/oslo.i18n/guidelines.html#avoid-forcing-the-translation-of-translatable-variables

Change-Id: I21d33573c518a612db2708fc9d04c428f0b50072
This commit is contained in:
Luong Anh Tuan
2016-09-28 15:59:26 +07:00
committed by Tuan Luong-Anh
parent 25a8c6c752
commit d35c3ba64e
3 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -607,10 +607,10 @@ class ResourceExceptionHandler(object):
ex_value, exc_info=exc_info)
raise Fault(webob.exc.HTTPBadRequest())
elif isinstance(ex_value, Fault):
LOG.info(_LI("Fault thrown: %s"), six.text_type(ex_value))
LOG.info(_LI("Fault thrown: %s"), ex_value)
raise ex_value
elif isinstance(ex_value, webob.exc.HTTPException):
LOG.info(_LI("HTTP exception thrown: %s"), six.text_type(ex_value))
LOG.info(_LI("HTTP exception thrown: %s"), ex_value)
raise Fault(ex_value)
# We didn't handle the exception
+5 -5
View File
@@ -47,10 +47,10 @@ class EvalConstant(object):
result = _vars[which_dict][entry]
except KeyError as e:
raise exception.EvaluatorParseException(
_("KeyError: %s") % six.text_type(e))
_("KeyError: %s") % e)
except TypeError as e:
raise exception.EvaluatorParseException(
_("TypeError: %s") % six.text_type(e))
_("TypeError: %s") % e)
try:
result = int(result)
@@ -59,7 +59,7 @@ class EvalConstant(object):
result = float(result)
except ValueError as e:
raise exception.EvaluatorParseException(
_("ValueError: %s") % six.text_type(e))
_("ValueError: %s") % e)
return result
@@ -105,7 +105,7 @@ class EvalMultOp(object):
prod /= float(val.eval())
except ZeroDivisionError as e:
raise exception.EvaluatorParseException(
_("ZeroDivisionError: %s") % six.text_type(e))
_("ZeroDivisionError: %s") % e)
return prod
@@ -292,6 +292,6 @@ def evaluate(expression, **kwargs):
result = _parser.parseString(expression, parseAll=True)[0]
except pyparsing.ParseException as e:
raise exception.EvaluatorParseException(
_("ParseException: %s") % six.text_type(e))
_("ParseException: %s") % e)
return result.eval()
+1 -1
View File
@@ -1692,7 +1692,7 @@ class EMCVMAXUtils(object):
instance = None
else:
# Something else that we cannot recover from has happened.
LOG.error(_LE("Exception: %s"), six.text_type(desc))
LOG.error(_LE("Exception: %s"), desc)
exceptionMessage = (_(
"Cannot verify the existence of object:"
"%(instanceName)s.")