diff options
-rw-r--r-- | pycadf/_i18n.py (renamed from pycadf/openstack/common/_i18n.py) | 11 | ||||
-rw-r--r-- | pycadf/middleware/notifier.py | 2 | ||||
-rw-r--r-- | pycadf/openstack/common/context.py | 8 | ||||
-rw-r--r-- | tox.ini | 5 |
4 files changed, 9 insertions, 17 deletions
diff --git a/pycadf/openstack/common/_i18n.py b/pycadf/_i18n.py index e9993ad..f3cc295 100644 --- a/pycadf/openstack/common/_i18n.py +++ b/pycadf/_i18n.py @@ -11,20 +11,13 @@ # under the License. """oslo.i18n integration module. - See http://docs.openstack.org/developer/oslo.i18n/usage.html - """ -import oslo.i18n +from oslo import i18n -# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the -# application name when this module is synced into the separate -# repository. It is OK to have more than one translation function -# using the same domain, since there will still only be one message -# catalog. -_translators = oslo.i18n.TranslatorFactory(domain='pycadf') +_translators = i18n.TranslatorFactory(domain='pycadf') # The primary translation function using the well-known name "_" _ = _translators.primary diff --git a/pycadf/middleware/notifier.py b/pycadf/middleware/notifier.py index adadb12..c94d6dd 100644 --- a/pycadf/middleware/notifier.py +++ b/pycadf/middleware/notifier.py @@ -23,8 +23,8 @@ import oslo.messaging import six import webob.dec +from pycadf._i18n import _ from pycadf.middleware import base -from pycadf.openstack.common._i18n import _ # noqa from pycadf.openstack.common import context LOG = None diff --git a/pycadf/openstack/common/context.py b/pycadf/openstack/common/context.py index b612db7..1689890 100644 --- a/pycadf/openstack/common/context.py +++ b/pycadf/openstack/common/context.py @@ -117,10 +117,6 @@ def get_context_from_function_and_args(function, args, kwargs): def is_user_context(context): """Indicates if the request context is a normal user.""" - if not context: + if not context or context.is_admin: return False - if context.is_admin: - return False - if not context.user_id or not context.project_id: - return False - return True + return context.user_id and context.project_id @@ -31,4 +31,7 @@ commands = oslo_debug_helper {posargs} show-source = True ignore = H405,H904 exclude = .tox,dist,doc,*.egg,build,./pycadf/openstack/common -builtins = _ + +[hacking] +import_exceptions = + pycadf._i18n |