Fix mixed usage of _

* all modules are using function of _ from oslo.i18n
* remove the definition of _ from openstack.common.__init__.py for safety

Change-Id: Ice2f8be1190fd13e8991a8c7fa55ca636341e875
Closes-Bug: #1382476
This commit is contained in:
Hideki Saito 2014-11-08 21:13:45 +09:00
parent 9ed73c04aa
commit 02c108fd00
4 changed files with 3 additions and 29 deletions

View File

@ -1,26 +0,0 @@
# Copyright 2011 VMware, Inc.
# 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.
import gettext
t = gettext.translation('neutronclient', fallback=True)
try:
ugettext = t.ugettext # Python 2
except AttributeError:
ugettext = t.gettext # Python 3
def _(msg):
return ugettext(msg)

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from neutronclient.common import _ from neutronclient.i18n import _
""" """
Neutron base exception handling. Neutron base exception handling.

View File

@ -24,8 +24,8 @@ from oslo.utils import encodeutils
from oslo.utils import importutils from oslo.utils import importutils
import six import six
from neutronclient.common import _
from neutronclient.common import exceptions from neutronclient.common import exceptions
from neutronclient.i18n import _
def env(*vars, **kwargs): def env(*vars, **kwargs):

View File

@ -21,11 +21,11 @@ import requests
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse
from neutronclient import client from neutronclient import client
from neutronclient.common import _
from neutronclient.common import constants from neutronclient.common import constants
from neutronclient.common import exceptions from neutronclient.common import exceptions
from neutronclient.common import serializer from neutronclient.common import serializer
from neutronclient.common import utils from neutronclient.common import utils
from neutronclient.i18n import _
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)