diff options
| author | Craig Blaszczyk | 2015-01-07 12:46:23 +0000 | 
|---|---|---|
| committer | Craig Blaszczyk | 2015-01-07 12:46:23 +0000 | 
| commit | 91e316f7810157474d6246cd0024bd7f7cc31ff7 (patch) | |
| tree | 1279d952e1bbc7cfb281cea90b7d215e15534ea1 /rest_framework/authentication.py | |
| parent | 9a4267049ba37883e3e0c21b5d453b9551343b8d (diff) | |
| download | django-rest-framework-91e316f7810157474d6246cd0024bd7f7cc31ff7.tar.bz2 | |
prefer single quotes in source and double quotes in user visible strings; add some missing full stops to user visible strings
Diffstat (limited to 'rest_framework/authentication.py')
| -rw-r--r-- | rest_framework/authentication.py | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py index 7e86a7b9..11db0585 100644 --- a/rest_framework/authentication.py +++ b/rest_framework/authentication.py @@ -66,16 +66,16 @@ class BasicAuthentication(BaseAuthentication):              return None          if len(auth) == 1: -            msg = _("Invalid basic header. No credentials provided.") +            msg = _('Invalid basic header. No credentials provided.')              raise exceptions.AuthenticationFailed(msg)          elif len(auth) > 2: -            msg = _("Invalid basic header. Credentials string should not contain spaces.") +            msg = _('Invalid basic header. Credentials string should not contain spaces.')              raise exceptions.AuthenticationFailed(msg)          try:              auth_parts = base64.b64decode(auth[1]).decode(HTTP_HEADER_ENCODING).partition(':')          except (TypeError, UnicodeDecodeError): -            msg = _("Invalid basic header. Credentials not correctly base64 encoded.") +            msg = _('Invalid basic header. Credentials not correctly base64 encoded.')              raise exceptions.AuthenticationFailed(msg)          userid, password = auth_parts[0], auth_parts[2] @@ -87,7 +87,7 @@ class BasicAuthentication(BaseAuthentication):          """          user = authenticate(username=userid, password=password)          if user is None or not user.is_active: -            raise exceptions.AuthenticationFailed(_("Invalid username/password.")) +            raise exceptions.AuthenticationFailed(_('Invalid username/password.'))          return (user, None)      def authenticate_header(self, request): @@ -153,10 +153,10 @@ class TokenAuthentication(BaseAuthentication):              return None          if len(auth) == 1: -            msg = _("Invalid token header. No credentials provided.") +            msg = _('Invalid token header. No credentials provided.')              raise exceptions.AuthenticationFailed(msg)          elif len(auth) > 2: -            msg = _("Invalid token header. Token string should not contain spaces.") +            msg = _('Invalid token header. Token string should not contain spaces.')              raise exceptions.AuthenticationFailed(msg)          return self.authenticate_credentials(auth[1]) @@ -165,10 +165,10 @@ class TokenAuthentication(BaseAuthentication):          try:              token = self.model.objects.get(key=key)          except self.model.DoesNotExist: -            raise exceptions.AuthenticationFailed(_("Invalid token")) +            raise exceptions.AuthenticationFailed(_('Invalid token.'))          if not token.user.is_active: -            raise exceptions.AuthenticationFailed(_("User inactive or deleted")) +            raise exceptions.AuthenticationFailed(_('User inactive or deleted.'))          return (token.user, token) | 
