Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove gettext magic and import _ explicitly

Instead of magically loading `_` into python built-in globals, import it
explicitly where needed.

Partially-implements: py3k-support
Change-Id: Icfedf9f86ead81bbee038506a91c456907af0d05
  • Loading branch information...
commit eef012d4c419af04babf869d9cc4763834de2957 1 parent ec18885
@FlaPer87 FlaPer87 authored
View
2  marconi/__init__.py
@@ -20,8 +20,6 @@
_sys.stderr.write('Running from marconi source directory.\n')
del _sys
except NameError:
- import gettext
- gettext.install('marconi', unicode=1)
import marconi.queues.bootstrap
Bootstrap = marconi.queues.bootstrap.Bootstrap
View
1  marconi/common/api.py
@@ -17,6 +17,7 @@
from jsonschema import validators
from marconi.common import errors
+from marconi.openstack.common.gettextutils import _
from marconi.openstack.common import log
LOG = log.getLogger(__name__)
View
1  marconi/common/cli.py
@@ -21,6 +21,7 @@
import sys
import termios
+from marconi.openstack.common.gettextutils import _
from marconi.openstack.common import log as logging
View
1  marconi/common/pipeline.py
@@ -33,6 +33,7 @@
import six
from marconi.common import decorators
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
LOG = logging.getLogger(__name__)
View
1  marconi/common/transport/wsgi/helpers.py
@@ -17,6 +17,7 @@
import falcon
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.queues.transport import validation
View
1  marconi/queues/bootstrap.py
@@ -19,6 +19,7 @@
from marconi.common.cache import cache as oslo_cache
from marconi.common import decorators
from marconi.common import errors
+from marconi.openstack.common.gettextutils import _
from marconi.openstack.common import log
from marconi.queues.storage import pipeline
from marconi.queues.storage import sharding
View
1  marconi/queues/storage/mongodb/messages.py
@@ -27,6 +27,7 @@
import pymongo.errors
import pymongo.read_preferences
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.openstack.common import timeutils
from marconi.queues import storage
View
1  marconi/queues/storage/mongodb/queues.py
@@ -23,6 +23,7 @@
import pymongo.errors
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.openstack.common import timeutils
from marconi.queues import storage
View
1  marconi/queues/storage/pipeline.py
@@ -19,6 +19,7 @@
from marconi import common
from marconi.common import decorators
+from marconi.openstack.common.gettextutils import _
from marconi.openstack.common import log as logging
from marconi.queues.storage import base
View
3  marconi/queues/transport/auth.py
@@ -17,6 +17,7 @@
from keystoneclient.middleware import auth_token
+from marconi.openstack.common.gettextutils import _
from marconi.openstack.common import log
@@ -40,7 +41,7 @@ def _register_opts(cls, conf):
@classmethod
def install(cls, app, conf):
"""Install Auth check on application."""
- LOG.debug(_(u"Installing Keystone's auth protocol"))
+ LOG.debug(_(u'Installing Keystone\'s auth protocol'))
cls._register_opts(conf)
conf = dict(conf.get(cls.OPT_GROUP_NAME))
return auth_token.AuthProtocol(app, conf=conf)
View
1  marconi/queues/transport/wsgi/claims.py
@@ -16,6 +16,7 @@
import falcon
import six
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.queues.storage import errors as storage_errors
from marconi.queues.transport import utils
View
1  marconi/queues/transport/wsgi/driver.py
@@ -24,6 +24,7 @@
from marconi.common import decorators
from marconi.common.transport import version
from marconi.common.transport.wsgi import helpers
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.queues import transport
from marconi.queues.transport import auth, validation
View
2  marconi/queues/transport/wsgi/errors.py
@@ -15,6 +15,8 @@
import falcon
+from marconi.openstack.common.gettextutils import _
+
class HTTPServiceUnavailable(falcon.HTTPServiceUnavailable):
"""Wraps falcon.HTTPServiceUnavailable with Marconi messaging."""
View
1  marconi/queues/transport/wsgi/messages.py
@@ -16,6 +16,7 @@
import falcon
import six
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.queues.storage import errors as storage_errors
from marconi.queues.transport import utils
View
1  marconi/queues/transport/wsgi/metadata.py
@@ -16,6 +16,7 @@
import falcon
import six
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.queues.storage import errors as storage_errors
from marconi.queues.transport import utils
View
1  marconi/queues/transport/wsgi/queues.py
@@ -16,6 +16,7 @@
import falcon
import six
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.queues.transport import utils
from marconi.queues.transport import validation
View
1  marconi/queues/transport/wsgi/stats.py
@@ -15,6 +15,7 @@
import falcon
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.queues.storage import errors as storage_errors
from marconi.queues.transport import utils
View
1  marconi/queues/transport/wsgi/utils.py
@@ -16,6 +16,7 @@
import uuid
+from marconi.openstack.common.gettextutils import _
import marconi.openstack.common.log as logging
from marconi.queues.transport import utils
from marconi.queues.transport.wsgi import errors
View
5 tox.ini
@@ -31,5 +31,8 @@ setenv = NOSE_WITH_COVERAGE=1
commands = {posargs}
[flake8]
-builtins = _,__MARCONI_SETUP__
+builtins = __MARCONI_SETUP__
exclude = .venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,.update-venv
+
+[hacking]
+import_exceptions = marconi.openstack.common.gettextutils._
Please sign in to comment.
Something went wrong with that request. Please try again.