diff options
author | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2015-11-27 12:03:07 +0800 |
---|---|---|
committer | ChangBo Guo(gcb) <eric.guo@easystack.cn> | 2015-11-27 12:03:07 +0800 |
commit | 2d76ae46feb75c67d2a1f029712999fd97929dfa (patch) | |
tree | 0d519c59ea36f2895fe3fb7a9a58548fdfb6b48e /oslo_i18n | |
parent | 835c89a9e55522894a271182ec7ef98a11a63b41 (diff) | |
download | oslo-i18n-2d76ae46feb75c67d2a1f029712999fd97929dfa.tar.gz |
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
Diffstat (limited to 'oslo_i18n')
-rw-r--r-- | oslo_i18n/_message.py | 10 | ||||
-rw-r--r-- | oslo_i18n/tests/test_message.py | 6 |
2 files changed, 0 insertions, 16 deletions
diff --git a/oslo_i18n/_message.py b/oslo_i18n/_message.py index 9dff366..d03337d 100644 --- a/oslo_i18n/_message.py +++ b/oslo_i18n/_message.py @@ -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) diff --git a/oslo_i18n/tests/test_message.py b/oslo_i18n/tests/test_message.py index 47dd365..ba7851f 100644 --- a/oslo_i18n/tests/test_message.py +++ b/oslo_i18n/tests/test_message.py @@ -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' |