Skip to content

Commit 3d3a75c

Browse files
committed
added support for python3.2
1 parent 9d5b939 commit 3d3a75c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

oauth2_provider/oauth2_validators.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import unicode_literals
22

3+
import six
34
import base64
45
import binascii
56
import logging
@@ -60,6 +61,11 @@ def _authenticate_basic_auth(self, request):
6061
except AttributeError:
6162
encoding = 'utf-8'
6263

64+
# Encode auth_string to bytes. This is needed for python3.2 compatibility
65+
# because b64decode function only supports bytes type in input.
66+
if isinstance(auth_string, six.string_types):
67+
auth_string = auth_string.encode(encoding)
68+
6369
try:
6470
b64_decoded = base64.b64decode(auth_string)
6571
except (TypeError, binascii.Error):

requirements/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Sphinx==1.3.1
22
South==1.0
33
oauthlib==1.0.1
4-
django-braces==1.4.0
4+
django-braces==1.8.1
55
six

0 commit comments

Comments
 (0)