VimExceptions need to support i18n objects

Bug #1374210 reported by Davanum Srinivas (DIMS)
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
James Carey
Fix Released
James Carey

Bug Description

When lazy is enabled the i18n translation object does not support
str() which causes failures like:
  UnicodeError: Message objects do not support str() because they may
  contain non-ascii characters. Please use unicode() or translate()

Tags: vmware
tags: added: vmware
Changed in nova:
status: New → Confirmed
Changed in oslo.vmware:
status: New → Confirmed
Changed in nova:
importance: Undecided → Medium
Changed in oslo.vmware:
importance: Undecided → High
Changed in nova:
assignee: nobody → James Carey (jecarey)
Changed in oslo.vmware:
assignee: nobody → James Carey (jecarey)
milestone: none → next-kilo
Revision history for this message
James Carey (jecarey) wrote :

Here is the failure when i18n lazy translation is enabled in Nova (note not enabled in Juno):


Captured traceback:
    Traceback (most recent call last):
      File "nova/tests/virt/vmwareapi/", line 113, in test_exception_with_deepcopy
        copy.deepcopy, self.vim)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/", line 420, in assertRaises
        self.assertThat(our_callable, matcher)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/", line 431, in assertThat
        mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/", line 481, in _matchHelper
        mismatch = matcher.match(matchee)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/", line 108, in match
        mismatch = self.exception_matcher.match(exc_info)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/", line 62, in match
        mismatch = matcher.match(matchee)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/", line 412, in match
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/", line 101, in match
        result = matchee()
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/testtools/", line 965, in __call__
        return self._callable_object(*self._args, **self._kwargs)
      File "/usr/lib/python2.7/", line 174, in deepcopy
        y = copier(memo)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo/vmware/", line 201, in request_handler
        _("No such SOAP method %s.") % attr_name, excep)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo/vmware/", line 52, in __init__
        self.msg = str(message)
      File "/opt/stack/nova/.tox/py27/local/lib/python2.7/site-packages/oslo/i18n/", line 167, in __str__
        raise UnicodeError(msg)
    UnicodeError: Message objects do not support str() because they may contain non-ascii characters. Please use unicode() or translate() instead.

Changed in oslo.vmware:
status: Confirmed → Fix Committed
Changed in oslo.vmware:
status: Fix Committed → Fix Released
Changed in nova:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers