Remove Python 2.6 workround for logging
You can find why we add it in [1], we don't support Python 2.6 any more, so we can remove the workaround now. [1] https://review.openstack.org/#/c/56093/8/openstack/common/gettextutils.py Change-Id: I5b67e3fcadbdd38f6e92e79f6549af5bafec29e4
This commit is contained in:
parent
835c89a9e5
commit
2d76ae46fe
@ -228,13 +228,3 @@ class Message(six.text_type):
|
||||
|
||||
def __radd__(self, other):
|
||||
return self.__add__(other)
|
||||
|
||||
if six.PY2:
|
||||
def __str__(self):
|
||||
# NOTE(luisg): Logging in python 2.6 tries to str() log records,
|
||||
# and it expects specifically a UnicodeError in order to proceed.
|
||||
from oslo_i18n._i18n import _
|
||||
msg = _('Message objects do not support str() because they may '
|
||||
'contain non-ascii characters. '
|
||||
'Please use unicode() or translate() instead.')
|
||||
raise UnicodeError(msg)
|
||||
|
@ -303,12 +303,6 @@ class MessageTestCase(test_base.BaseTestCase):
|
||||
test_me = lambda: utils.SomeObject('test') + _message.Message(msgid)
|
||||
self.assertRaises(TypeError, test_me)
|
||||
|
||||
@testtools.skipIf(six.PY3, 'test specific to Python 2')
|
||||
def test_str_disabled(self):
|
||||
msgid = "A message"
|
||||
test_me = lambda: str(_message.Message(msgid))
|
||||
self.assertRaises(UnicodeError, test_me)
|
||||
|
||||
@mock.patch('gettext.translation')
|
||||
def test_translate(self, mock_translation):
|
||||
en_message = 'A message in the default locale'
|
||||
|
Loading…
Reference in New Issue
Block a user