diff --git a/lms/djangoapps/oauth2_handler/__init__.py b/lms/djangoapps/oauth2_handler/__init__.py index fe4953f6ac514b125f1884790916de2cf2a07b95..bb3f7ed55a038681c24301a59ea7db1bb8f0d557 100644 --- a/lms/djangoapps/oauth2_handler/__init__.py +++ b/lms/djangoapps/oauth2_handler/__init__.py @@ -1 +1,5 @@ +""" Handlers for OpenID Connect provider. """ + +from __future__ import absolute_import + from oauth2_handler.handlers import IDTokenHandler, UserInfoHandler diff --git a/lms/djangoapps/oauth2_handler/handlers.py b/lms/djangoapps/oauth2_handler/handlers.py index da7f44043daf7a22b882a28fc51a457746a9ea33..c8b8ad9211f4787337d274652cf572b538b87d73 100644 --- a/lms/djangoapps/oauth2_handler/handlers.py +++ b/lms/djangoapps/oauth2_handler/handlers.py @@ -1,5 +1,8 @@ """ Handlers for OpenID Connect provider. """ +from __future__ import absolute_import + +import six from django.conf import settings from django.core.cache import cache @@ -209,7 +212,7 @@ class CourseAccessHandler(object): if not GlobalStaff().has_user(user): course_keys = [course_key for course_key in course_keys if has_access(user, access_type, course_key)] - course_ids = [unicode(course_key) for course_key in course_keys] + course_ids = [six.text_type(course_key) for course_key in course_keys] cache.set(key, course_ids, self.COURSE_CACHE_TIMEOUT) diff --git a/lms/djangoapps/oauth2_handler/tests.py b/lms/djangoapps/oauth2_handler/tests.py index b8148d7c0741f18da90df589c70cbd9f200429f4..169eef8955aebacbbf4ae895131792e0fd070016 100644 --- a/lms/djangoapps/oauth2_handler/tests.py +++ b/lms/djangoapps/oauth2_handler/tests.py @@ -1,5 +1,8 @@ # pylint: disable=missing-docstring +from __future__ import absolute_import + import mock +import six from django.core.cache import cache from django.test.utils import override_settings # Will also run default tests for IDTokens and UserInfo @@ -21,7 +24,7 @@ class BaseTestMixin(ModuleStoreTestCase): def setUp(self): super(BaseTestMixin, self).setUp() self.course_key = CourseFactory.create(emit_signals=True).id - self.course_id = unicode(self.course_key) + self.course_id = six.text_type(self.course_key) self.user_factory = UserFactory self.set_user(self.make_user()) @@ -106,7 +109,7 @@ class IDTokenTest(BaseTestMixin, IDTokenTestCase): def test_course_staff_courses_with_claims(self): CourseStaffRole(self.course_key).add_users(self.user) - course_id = unicode(self.course_key) + course_id = six.text_type(self.course_key) nonexistent_course_id = 'some/other/course' diff --git a/lms/djangoapps/staticbook/tests.py b/lms/djangoapps/staticbook/tests.py index e8c62ac321e2e9fab513402e773959aa4995d4dd..aaaedc0a04b6e8a7bc8df51d46f7c68ce178b859 100644 --- a/lms/djangoapps/staticbook/tests.py +++ b/lms/djangoapps/staticbook/tests.py @@ -2,6 +2,8 @@ Test the lms/staticbook views. """ +from __future__ import absolute_import + import textwrap import mock diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 2137a30678ae0c04d5398b6f004e2cd291a26d02..2e0e33198b5fe9c26aec218c86c84e6f55198dcc 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -2,9 +2,11 @@ Views for serving static textbooks. """ +from __future__ import absolute_import + from django.contrib.auth.decorators import login_required -from django.views.decorators.clickjacking import xframe_options_exempt from django.http import Http404 +from django.views.decorators.clickjacking import xframe_options_exempt from opaque_keys.edx.keys import CourseKey from courseware.access import has_access