REST API errors are not being translated on response

Bug #1275901 reported by Luis A. Garcia
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Undecided
Luis A. Garcia

Bug Description

REST API response errors are not being translated after re-enabling the lazy translation feature.

For example doing:
GET http://ceilometer:8777/v2/resources/1
GET http://ceilometer:8777/v2/alarms/1
Accept-Language: [some non-default locale]

Which should return a translated response, but it does not.

The reason is that the lazy _() function is installed with gettextutils.install() but it's then overriden by re-importing it in some modules.

Luis A. Garcia (luisg-8)
Changed in ceilometer:
assignee: nobody → Luis A. Garcia (luisg-8)
Changed in ceilometer:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

Fix proposed to branch: master
Review: https://review.openstack.org/78063

gordon chung (chungg)
Changed in ceilometer:
milestone: none → icehouse-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/70824
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=66e10a6c88b2e3807122b01df77b89b27e5caeb3
Submitter: Jenkins
Branch: master

commit 66e10a6c88b2e3807122b01df77b89b27e5caeb3
Author: Luis A. Garcia <email address hidden>
Date: Thu Mar 6 14:23:32 2014 -0700

    Install global lazy _()

    The patch installs the lazy _() function, which returns translatable
    Message objects, globally via the enable_lazy() method such that
    translation works in all modules.

    Since Messages objects can't be str()'d and native exceptions str()
    their messages the patch also removes passing Messages to native
    exceptions.

    Change-Id: I8a4ecd904e393c4bd0308cdeafa3cf1d8f0e70fe
    Closes-Bug: #1275901

Changed in ceilometer:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.