diff options
author | Jamie Lennox <jamielennox@redhat.com> | 2015-05-26 17:02:10 +1000 |
---|---|---|
committer | Jamie Lennox <jamielennox@redhat.com> | 2015-05-26 17:02:10 +1000 |
commit | deeab3c164171ecdbc3a57e3fe5120f1454438d3 (patch) | |
tree | e179b93ac066772ce1f2a69ada440f9ee3751940 /keystoneclient/session.py | |
parent | 4776495adfadbf5240a9e0f169990ce139af9549 (diff) | |
download | python-keystoneclient-deeab3c164171ecdbc3a57e3fe5120f1454438d3.tar.gz |
Fix auth required message translation
Passing a string that is formatted into a translation function doesn't
work. We need to pass the full translatable string.
Change-Id: I94b13f18c19b3b872fab380f8822a88db1b876e9
Diffstat (limited to 'keystoneclient/session.py')
-rw-r--r-- | keystoneclient/session.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/keystoneclient/session.py b/keystoneclient/session.py index 55e6503..0dbc065 100644 --- a/keystoneclient/session.py +++ b/keystoneclient/session.py @@ -574,8 +574,7 @@ class Session(object): auth = self.auth if not auth: - msg_fmt = _('An auth plugin is required to %s') - raise exceptions.MissingAuthPlugin(msg_fmt % msg) + raise exceptions.MissingAuthPlugin(msg) return auth @@ -594,7 +593,8 @@ class Session(object): :returns: Authentication headers or None for failure. :rtype: dict """ - auth = self._auth_required(auth, 'fetch a token') + msg = _('An auth plugin is required to fetch a token') + auth = self._auth_required(auth, msg) return auth.get_headers(self, **kwargs) def get_token(self, auth=None): @@ -631,7 +631,8 @@ class Session(object): :returns: An endpoint if available or None. :rtype: string """ - auth = self._auth_required(auth, 'determine endpoint URL') + msg = _('An auth plugin is required to determine endpoint URL') + auth = self._auth_required(auth, msg) return auth.get_endpoint(self, **kwargs) def invalidate(self, auth=None): @@ -642,7 +643,8 @@ class Session(object): :type auth: :py:class:`keystoneclient.auth.base.BaseAuthPlugin` """ - auth = self._auth_required(auth, 'validate') + msg = _('An auth plugin is required to validate') + auth = self._auth_required(auth, msg) return auth.invalidate() def get_user_id(self, auth=None): @@ -659,7 +661,8 @@ class Session(object): :returns string: Current user_id or None if not supported by plugin. """ - auth = self._auth_required(auth, 'get user_id') + msg = _('An auth plugin is required to get user_id') + auth = self._auth_required(auth, msg) return auth.get_user_id(self) def get_project_id(self, auth=None): @@ -676,7 +679,8 @@ class Session(object): :returns string: Current project_id or None if not supported by plugin. """ - auth = self._auth_required(auth, 'get project_id') + msg = _('An auth plugin is required to get project_id') + auth = self._auth_required(auth, msg) return auth.get_project_id(self) @utils.positional.classmethod() |