Revert "Merge "Re-enable lazy translation""
Revert enabling lazy translation, which doesn't work in many places because we're doing string concatenation. This reverts commit1864efa320
, reversing changes made to92e3e3ce74
. Closes-Bug: #1281644 Change-Id: Iac0be685f8bb60f81715c0dd3dbe35787e38ee39
This commit is contained in:
parent
7c2c54f04d
commit
8b1b7d132e
|
@ -33,8 +33,7 @@ if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
|
|||
|
||||
from heat.openstack.common import gettextutils
|
||||
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('heat', lazy=True)
|
||||
gettextutils.install('heat', lazy=False)
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
|
|||
|
||||
from heat.openstack.common import gettextutils
|
||||
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('heat', lazy=True)
|
||||
gettextutils.install('heat', lazy=False)
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
|
|||
|
||||
from heat.openstack.common import gettextutils
|
||||
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('heat', lazy=True)
|
||||
gettextutils.install('heat', lazy=False)
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')):
|
|||
|
||||
from heat.openstack.common import gettextutils
|
||||
|
||||
gettextutils.enable_lazy()
|
||||
gettextutils.install('heat', lazy=True)
|
||||
gettextutils.install('heat', lazy=False)
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
|
|
|
@ -119,14 +119,11 @@ class HeatException(Exception):
|
|||
raise exc_info[0], exc_info[1], exc_info[2]
|
||||
|
||||
def __str__(self):
|
||||
return unicode(self.message).encode('UTF-8')
|
||||
return str(self.message)
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.message)
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
return self.__class__(**self.kwargs)
|
||||
|
||||
|
||||
class MissingCredentialError(HeatException):
|
||||
msg_fmt = _("Missing required credential: %(required)s")
|
||||
|
|
|
@ -774,7 +774,7 @@ def log_exception(err, exc_info):
|
|||
|
||||
def translate_exception(exc, locale):
|
||||
"""Translates all translatable elements of the given exception."""
|
||||
exc.message = gettextutils.translate(unicode(exc), locale)
|
||||
exc.message = gettextutils.translate(str(exc), locale)
|
||||
if isinstance(exc, webob.exc.HTTPError):
|
||||
# If the explanation is not a Message, that means that the
|
||||
# explanation is the default, generic and not translatable explanation
|
||||
|
@ -783,7 +783,7 @@ def translate_exception(exc, locale):
|
|||
# message, since message is what gets passed in at construction time
|
||||
# in the API
|
||||
if not isinstance(exc.explanation, gettextutils.Message):
|
||||
exc.explanation = unicode(exc)
|
||||
exc.explanation = str(exc)
|
||||
exc.detail = ''
|
||||
else:
|
||||
exc.explanation = \
|
||||
|
|
Loading…
Reference in New Issue