summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgordon chung <gord@live.ca>2014-12-02 09:35:40 -0500
committergordon chung <gord@live.ca>2014-12-10 12:05:03 -0500
commiteeb1df1315d762d4a04e816b20b6bad694543839 (patch)
treef5a2efb20a2fb41f28172dcbcf58849a109644ac
parenta85f0125a43101927696d173167531304f79d4c7 (diff)
downloadpycadf-eeb1df1315d762d4a04e816b20b6bad694543839.tar.gz
sync oslo
this patch also corrects an issue where we incorrectly referenced common._i18n this patch syncs to: Ia1820495a989f4f84530ab83f2d87d53a9f761df Change-Id: Ia192869d7e92732000b9033b09b97316ba5d5028
-rw-r--r--pycadf/_i18n.py (renamed from pycadf/openstack/common/_i18n.py)11
-rw-r--r--pycadf/middleware/notifier.py2
-rw-r--r--pycadf/openstack/common/context.py8
-rw-r--r--tox.ini5
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
diff --git a/tox.ini b/tox.ini
index 75d37fd..9385341 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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