summaryrefslogtreecommitdiff
path: root/keystoneclient/v2_0/client.py
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2014-10-27 10:54:48 -0500
committerJamie Lennox <jamielennox@redhat.com>2014-10-28 20:33:19 +0000
commitfece74ca3e56342bee43f561404c19128a613628 (patch)
tree7241c8dcb7f3176da3df660dbfb5006f9eb86fc1 /keystoneclient/v2_0/client.py
parent3b766c51438396a0ab0032de309c9d56e275e0cb (diff)
downloadpython-keystoneclient-fece74ca3e56342bee43f561404c19128a613628.tar.gz
I18n
Keystoneclient didn't provide translated messages. With this change, the messages are marked for translation. DocImpact Implements: blueprint keystoneclient-i18n Change-Id: I85263a71671a1dffed524185266e6bb7ae559630
Diffstat (limited to 'keystoneclient/v2_0/client.py')
-rw-r--r--keystoneclient/v2_0/client.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/keystoneclient/v2_0/client.py b/keystoneclient/v2_0/client.py
index 062678f..030632b 100644
--- a/keystoneclient/v2_0/client.py
+++ b/keystoneclient/v2_0/client.py
@@ -18,6 +18,7 @@ import logging
from keystoneclient.auth.identity import v2 as v2_auth
from keystoneclient import exceptions
from keystoneclient import httpclient
+from keystoneclient.i18n import _
from keystoneclient.v2_0 import ec2
from keystoneclient.v2_0 import endpoints
from keystoneclient.v2_0 import extensions
@@ -163,7 +164,7 @@ class Client(httpclient.HTTPClient):
"""
try:
if auth_url is None:
- raise ValueError("Cannot authenticate without an auth_url")
+ raise ValueError(_("Cannot authenticate without an auth_url"))
new_kwargs = {'trust_id': trust_id,
'tenant_id': project_id or tenant_id,
@@ -175,7 +176,7 @@ class Client(httpclient.HTTPClient):
plugin = v2_auth.Password(auth_url, username, password,
**new_kwargs)
else:
- msg = 'A username and password or token is required.'
+ msg = _('A username and password or token is required.')
raise exceptions.AuthorizationFailure(msg)
return plugin.get_auth_ref(self.session)
@@ -183,8 +184,9 @@ class Client(httpclient.HTTPClient):
_logger.debug("Authorization Failed.")
raise
except exceptions.EndpointNotFound:
- msg = 'There was no suitable authentication url for this request'
+ msg = (
+ _('There was no suitable authentication url for this request'))
raise exceptions.AuthorizationFailure(msg)
except Exception as e:
- raise exceptions.AuthorizationFailure("Authorization Failed: "
- "%s" % e)
+ raise exceptions.AuthorizationFailure(
+ _("Authorization Failed: %s") % e)