Remove gettext.install from quantumclient.__init__

fix bug 1097628

Change-Id: Ic6f2dfb4593fa507fb788786616bff6af3cbb896
This commit is contained in:
He Jie Xu 2013-01-19 21:39:40 +08:00
parent 2bca8ee440
commit 6cc6875b38
6 changed files with 34 additions and 7 deletions

View File

@ -15,9 +15,3 @@
# License for the specific language governing permissions and limitations
# under the License.
# @author: Tyler Smith, Cisco Systems
import gettext
# gettext must be initialized before any quantumclient imports
gettext.install('quantumclient', unicode=1)

View File

@ -14,3 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
# @author: Somik Behera, Nicira Networks, Inc.
import gettext
t = gettext.translation('quantumclient', fallback=True)
def _(msg):
return t.ugettext(msg)

View File

@ -15,6 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from quantumclient.common import _
"""
Quantum base exception handling.
"""

View File

@ -33,7 +33,6 @@ from quantumclient.common import exceptions as exc
from quantumclient.common import utils
gettext.install('quantum', unicode=1)
VERSION = '2.0'
QUANTUM_API_VERSION = '2.0'
@ -564,6 +563,7 @@ class QuantumShell(App):
def main(argv=sys.argv[1:]):
gettext.install('quantumclient', unicode=1)
try:
return QuantumShell(QUANTUM_API_VERSION).run(argv)
except exc.QuantumClientException:

View File

@ -0,0 +1,22 @@
# Copyright 2013 OpenStack LLC.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
import gettext
# Because we installed '_' for quantum cli in shell.py, this help unittest
# have definition of '_'
gettext.install('quantumclient', unicode=1)

View File

@ -21,6 +21,7 @@ import time
import urllib
from quantumclient.client import HTTPClient
from quantumclient.common import _
from quantumclient.common import exceptions
from quantumclient.common.serializer import Serializer