From 3bc703b823969a08fc88bfb20e3d2440927dadb7 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 21 Jan 2015 19:48:41 -0500 Subject: Move i18n module to a private name The i18n module for this library is private to the library and should never be used by outside code. Rename the module to reflect this. Change-Id: I39149056daeeb27428b938fb9cd7278cd42f2444 --- oslo_middleware/_i18n.py | 35 ++++++++++++++++++++++++++ oslo_middleware/catch_errors.py | 2 +- oslo_middleware/healthcheck/disable_by_file.py | 2 +- oslo_middleware/i18n.py | 35 -------------------------- oslo_middleware/sizelimit.py | 2 +- tox.ini | 2 +- 6 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 oslo_middleware/_i18n.py delete mode 100644 oslo_middleware/i18n.py diff --git a/oslo_middleware/_i18n.py b/oslo_middleware/_i18n.py new file mode 100644 index 0000000..2025741 --- /dev/null +++ b/oslo_middleware/_i18n.py @@ -0,0 +1,35 @@ +# 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. + +"""oslo.i18n integration module. + +See http://docs.openstack.org/developer/oslo.i18n/usage.html + +""" + +import oslo_i18n + + +_translators = oslo_i18n.TranslatorFactory(domain='oslo.middleware') + +# The primary translation function using the well-known name "_" +_ = _translators.primary + +# Translators for log levels. +# +# The abbreviated names are meant to reflect the usual use of a short +# name like '_'. The "L" is for "log" and the other letter comes from +# the level. +_LI = _translators.log_info +_LW = _translators.log_warning +_LE = _translators.log_error +_LC = _translators.log_critical diff --git a/oslo_middleware/catch_errors.py b/oslo_middleware/catch_errors.py index 89b4bd9..5004859 100644 --- a/oslo_middleware/catch_errors.py +++ b/oslo_middleware/catch_errors.py @@ -18,8 +18,8 @@ import logging import webob.dec import webob.exc +from oslo_middleware._i18n import _LE from oslo_middleware import base -from oslo_middleware.i18n import _LE LOG = logging.getLogger(__name__) diff --git a/oslo_middleware/healthcheck/disable_by_file.py b/oslo_middleware/healthcheck/disable_by_file.py index 7e964a4..05d61bf 100644 --- a/oslo_middleware/healthcheck/disable_by_file.py +++ b/oslo_middleware/healthcheck/disable_by_file.py @@ -16,8 +16,8 @@ import logging import os +from oslo_middleware._i18n import _LW from oslo_middleware.healthcheck import pluginbase -from oslo_middleware.i18n import _LW LOG = logging.getLogger(__name__) diff --git a/oslo_middleware/i18n.py b/oslo_middleware/i18n.py deleted file mode 100644 index 2025741..0000000 --- a/oslo_middleware/i18n.py +++ /dev/null @@ -1,35 +0,0 @@ -# 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. - -"""oslo.i18n integration module. - -See http://docs.openstack.org/developer/oslo.i18n/usage.html - -""" - -import oslo_i18n - - -_translators = oslo_i18n.TranslatorFactory(domain='oslo.middleware') - -# The primary translation function using the well-known name "_" -_ = _translators.primary - -# Translators for log levels. -# -# The abbreviated names are meant to reflect the usual use of a short -# name like '_'. The "L" is for "log" and the other letter comes from -# the level. -_LI = _translators.log_info -_LW = _translators.log_warning -_LE = _translators.log_error -_LC = _translators.log_critical diff --git a/oslo_middleware/sizelimit.py b/oslo_middleware/sizelimit.py index d3f3039..d4f1ca9 100644 --- a/oslo_middleware/sizelimit.py +++ b/oslo_middleware/sizelimit.py @@ -22,8 +22,8 @@ from oslo_config import cfgfilter import webob.dec import webob.exc +from oslo_middleware._i18n import _ from oslo_middleware import base -from oslo_middleware.i18n import _ _oldopts = [cfg.DeprecatedOpt('osapi_max_request_body_size', diff --git a/tox.ini b/tox.ini index ea321a6..189804e 100644 --- a/tox.ini +++ b/tox.ini @@ -37,4 +37,4 @@ ignore = E123,E125,H305,H803,H904 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py [hacking] -import_exceptions = oslo_middleware.i18n +import_exceptions = oslo_middleware._i18n -- cgit v1.2.1