REST API translation not always working

Bug #1212882 reported by Luis A. Garcia
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Luis A. Garcia

Bug Description

Messages that include replacements need to be invoked twice in order to be translated.

For example:

Request 1:
GET /v2.0/agents/blah
Accept-Language: es

Response:
{
NeutronError: "Agent blah could not be found"
}

Then the second time:

Request 2:
GET /v2.0/agents/blah
Accept-Language: es

{
NeutronError: "El Agente blah no fue encontrado."
}

Tags: translation
Luis A. Garcia (luisg-8)
Changed in neutron:
assignee: nobody → Luis A. Garcia (luisg-8)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: New → In Progress
tags: added: translation
Changed in neutron:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/42387
Committed: http://github.com/openstack/neutron/commit/7e2622c2fc89611a34c242792f46572545bcdffb
Submitter: Jenkins
Branch: master

commit 7e2622c2fc89611a34c242792f46572545bcdffb
Author: Luis A. Garcia <email address hidden>
Date: Fri Aug 16 16:07:47 2013 +0000

    Enhance exception translation to better handle NeutronExceptions

    NeutronExceptions have a 'message' class attribute that holds the
    generic error message template, e.g. "Network %(network)s not found",
    unfortunately, because the names are the same, it was overshadowing the
    actual exception instance 'message', e.g. "Network 1 not found", after
    translation when the exception was serialized to JSON.

    This patch puts the exception's actual message in a new field called
    'msg' and overwrites NeutronException unicode() so that 'msg' is used
    during serialization and we'll get the correct message on the REST API
    response.

    Fixes bug: #1212882

    Change-Id: I3965bffb1c2c2eee0af440d1ecd30ccb3bb958d5

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

Other bug subscribers

Remote bug watches

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