diff options
| author | Xavier Ordoquy | 2012-11-22 00:20:49 +0100 | 
|---|---|---|
| committer | Xavier Ordoquy | 2012-11-22 00:20:49 +0100 | 
| commit | b3698acb6c0b9eaa04189599e27014c788a75adc (patch) | |
| tree | 25de3a90ca99b6de980ce0c4031ffb512d9f9c00 /rest_framework/authentication.py | |
| parent | ab3c47297481b7a4ff66027618f9c05bf02a2204 (diff) | |
| download | django-rest-framework-b3698acb6c0b9eaa04189599e27014c788a75adc.tar.bz2 | |
First passing test under p3k \o/
Diffstat (limited to 'rest_framework/authentication.py')
| -rw-r--r-- | rest_framework/authentication.py | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py index 30c78ebc..4b18b40c 100644 --- a/rest_framework/authentication.py +++ b/rest_framework/authentication.py @@ -3,7 +3,11 @@ Provides a set of pluggable authentication policies.  """  from django.contrib.auth import authenticate -from django.utils.encoding import smart_unicode, DjangoUnicodeDecodeError +from django.utils.encoding import DjangoUnicodeDecodeError +try: +    from django.utils.encoding import smart_text +except ImportError: +    from django.utils.encoding import smart_unicode as smart_text  from rest_framework import exceptions  from rest_framework.compat import CsrfViewMiddleware  from rest_framework.authtoken.models import Token @@ -41,8 +45,8 @@ class BasicAuthentication(BaseAuthentication):                      return None                  try: -                    userid = smart_unicode(auth_parts[0]) -                    password = smart_unicode(auth_parts[2]) +                    userid = smart_text(auth_parts[0]) +                    password = smart_text(auth_parts[2])                  except DjangoUnicodeDecodeError:                      return None | 
