← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1160644] Re: Quantum xml doesn't work with unicode

 

Reviewed:  https://review.openstack.org/25922
Committed: http://github.com/openstack/quantum/commit/46af52f24de13ce535a81573210d1a4f1bd93d96
Submitter: Jenkins
Branch:    milestone-proposed

commit 46af52f24de13ce535a81573210d1a4f1bd93d96
Author: He Jie Xu <xuhj@xxxxxxxxxxxxxxxxxx>
Date:   Wed Mar 27 07:42:20 2013 +0800

    Return unicode for object in json and xml serializer
    
    Fix bug 1160644
    Fix bug 1119790
    
    When try to serialize an exception object as json, it failed
    with 'ValueError: Circular reference detected' that is same error
    as bug 119790. So this patch fixes bug 119790 too.
    
    Change-Id: I0da2616f4ec59da31be054b8be2f7a140f59d63a
    (cherry picked from commit 26dca9ff02dc9eb9b431ea66ec60fb828b4ae0a5)


** Changed in: quantum
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to quantum.
https://bugs.launchpad.net/bugs/1160644

Title:
  Quantum xml doesn't work with unicode

Status in OpenStack Quantum (virtual network service):
  Fix Released

Bug description:
  When enable Chinese translation file and raise an exception that
  translated by Chinese will get exception as below:

  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 382, in handle_one_response
      result = self.application(self.environ, start_response)
    File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 203, in __call__
      return app(environ, start_response)
    File "/usr/local/lib/python2.7/dist-packages/python_keystoneclient-0.2.2.21.g92bf8a7-py2.7.egg/keystoneclient/middleware/auth_token.py", line 348, in __call__
      return self.app(env, start_response)
    File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
      response = self.app(environ, start_response)
    File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
      response = self.app(environ, start_response)
    File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
      return resp(environ, start_response)
    File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
      return self.func(req, *args, **kwargs)
    File "/home/soulxu/work-code/openstack/quantum/quantum/api/v2/resource.py", line 86, in resource
      body = serializer.serialize({'QuantumError': str(e)})
  UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)

  How to reproduce:
  1. initialize or update template to chinese template

  initialize:
  python ./setup.py init_catalog -l zh_CN -i quantum/locale/quantum.pot                          -o quantum/locale/zh_CN/LC_MESSAGES/quantum.po

  update:
  python ./setup.py update_catalog -l zh_CN -i quantum/locale/quantum.pot -o quantum/locale/zh_CN/LC_MESSAGES/quantum.po

  2. Translate a message of exception that you want to raise. There is
  chinese for test '中文中文'

  3. compile catalog
  python ./setup.py compile_catalog --directory quantum/locale --locale zh_CN

  4. cp quantum/locale/zh_CN/LC_MESSAGES/quantum.mo
  /usr/share/locale/zh_CN/LC_MESSAGES/

  5. running quantum with env varables: LANGUAGE=zh_CN:zh
  LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8

  6. then use quantum cli tools to raise the error that you have
  translated.

To manage notifications about this bug go to:
https://bugs.launchpad.net/quantum/+bug/1160644/+subscriptions