diff --git a/lms/djangoapps/ccx/migrations/0001_initial.py b/lms/djangoapps/ccx/migrations/0001_initial.py index e3d54d7a3d5f7a35672b76af8ee22c7ff593772b..0b8557e624705556e3f8399cb87df12891988fb3 100644 --- a/lms/djangoapps/ccx/migrations/0001_initial.py +++ b/lms/djangoapps/ccx/migrations/0001_initial.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +from __future__ import absolute_import from django.db import migrations, models from django.conf import settings from opaque_keys.edx.django.models import CourseKeyField, UsageKeyField diff --git a/lms/djangoapps/ccx/migrations/0002_customcourseforedx_structure_json.py b/lms/djangoapps/ccx/migrations/0002_customcourseforedx_structure_json.py index 0ca713e4a550264c9a8dad928323458abc4edf07..531c440f0c45c908aebc7d226eef5e2ee73cc448 100644 --- a/lms/djangoapps/ccx/migrations/0002_customcourseforedx_structure_json.py +++ b/lms/djangoapps/ccx/migrations/0002_customcourseforedx_structure_json.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +from __future__ import absolute_import from django.db import migrations, models diff --git a/lms/djangoapps/ccx/migrations/0003_add_master_course_staff_in_ccx.py b/lms/djangoapps/ccx/migrations/0003_add_master_course_staff_in_ccx.py index 977a69b5b8428bc3ff1bfecc08bf983670ff1d28..18c3f8d73c89ea747609574bd81f27f0851f6b84 100644 --- a/lms/djangoapps/ccx/migrations/0003_add_master_course_staff_in_ccx.py +++ b/lms/djangoapps/ccx/migrations/0003_add_master_course_staff_in_ccx.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +from __future__ import absolute_import import logging from ccx_keys.locator import CCXLocator @@ -12,6 +13,7 @@ from lms.djangoapps.ccx.utils import ( add_master_course_staff_to_ccx, remove_master_course_staff_from_ccx, ) +import six log = logging.getLogger("edx.ccx") @@ -31,7 +33,7 @@ def add_master_course_staff_to_ccx_for_existing_ccx(apps, schema_editor): if not ccx.course_id or ccx.course_id.deprecated: # prevent migration for deprecated course ids or invalid ids. continue - ccx_locator = CCXLocator.from_course_locator(ccx.course_id, unicode(ccx.id)) + ccx_locator = CCXLocator.from_course_locator(ccx.course_id, six.text_type(ccx.id)) try: course = get_course_by_id(ccx.course_id) add_master_course_staff_to_ccx( @@ -63,7 +65,7 @@ def remove_master_course_staff_from_ccx_for_existing_ccx(apps, schema_editor): if not ccx.course_id or ccx.course_id.deprecated: # prevent migration for deprecated course ids or invalid ids. continue - ccx_locator = CCXLocator.from_course_locator(ccx.course_id, unicode(ccx.id)) + ccx_locator = CCXLocator.from_course_locator(ccx.course_id, six.text_type(ccx.id)) try: course = get_course_by_id(ccx.course_id) remove_master_course_staff_from_ccx( diff --git a/lms/djangoapps/ccx/migrations/0004_seed_forum_roles_in_ccx_courses.py b/lms/djangoapps/ccx/migrations/0004_seed_forum_roles_in_ccx_courses.py index 41d526301b1ae99c6cfe41e12ffbfcb2b78da16d..3ab070d592183c554d630ef756c5359ae90d5d39 100644 --- a/lms/djangoapps/ccx/migrations/0004_seed_forum_roles_in_ccx_courses.py +++ b/lms/djangoapps/ccx/migrations/0004_seed_forum_roles_in_ccx_courses.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +from __future__ import absolute_import import logging from ccx_keys.locator import CCXLocator @@ -12,6 +13,7 @@ from openedx.core.djangoapps.django_comment_common.models import FORUM_ROLE_ADMI FORUM_ROLE_COMMUNITY_TA, FORUM_ROLE_STUDENT from openedx.core.djangoapps.django_comment_common.utils import STUDENT_ROLE_PERMISSIONS, MODERATOR_ROLE_PERMISSIONS, \ ADMINISTRATOR_ROLE_PERMISSIONS +import six log = logging.getLogger("edx.ccx") @@ -44,7 +46,7 @@ def seed_forum_roles_for_existing_ccx(apps, schema_editor): ) continue - ccx_locator = CCXLocator.from_course_locator(ccx.course_id, unicode(ccx.id)) + ccx_locator = CCXLocator.from_course_locator(ccx.course_id, six.text_type(ccx.id)) # Create forum roles. admin_role, _ = Role.objects.get_or_create(name=FORUM_ROLE_ADMINISTRATOR, course_id=ccx_locator) diff --git a/lms/djangoapps/ccx/migrations/0005_change_ccx_coach_to_staff.py b/lms/djangoapps/ccx/migrations/0005_change_ccx_coach_to_staff.py index 64fb547554d0af5dfaa7a4254208eff328567476..98ee96d0ee0f965aabfa326fceac48cc82109527 100644 --- a/lms/djangoapps/ccx/migrations/0005_change_ccx_coach_to_staff.py +++ b/lms/djangoapps/ccx/migrations/0005_change_ccx_coach_to_staff.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +from __future__ import absolute_import import logging from django.contrib.auth.models import User @@ -9,6 +10,7 @@ from django.http import Http404 from ccx_keys.locator import CCXLocator from courseware.courses import get_course_by_id from instructor.access import allow_access, revoke_access +import six log = logging.getLogger("edx.ccx") @@ -31,18 +33,18 @@ def change_existing_ccx_coaches_to_staff(apps, schema_editor): return list_ccx = CustomCourseForEdX.objects.using(db_alias).all() for ccx in list_ccx: - ccx_locator = CCXLocator.from_course_locator(ccx.course_id, unicode(ccx.id)) + ccx_locator = CCXLocator.from_course_locator(ccx.course_id, six.text_type(ccx.id)) try: course = get_course_by_id(ccx_locator) except Http404: - log.error('Could not migrate access for CCX course: %s', unicode(ccx_locator)) + log.error('Could not migrate access for CCX course: %s', six.text_type(ccx_locator)) else: coach = User.objects.get(id=ccx.coach.id) allow_access(course, coach, 'staff', send_email=False) revoke_access(course, coach, 'ccx_coach', send_email=False) log.info( 'The CCX coach of CCX %s has been switched from "CCX Coach" to "Staff".', - unicode(ccx_locator) + six.text_type(ccx_locator) ) def revert_ccx_staff_to_coaches(apps, schema_editor): @@ -61,18 +63,18 @@ def revert_ccx_staff_to_coaches(apps, schema_editor): return list_ccx = CustomCourseForEdX.objects.using(db_alias).all() for ccx in list_ccx: - ccx_locator = CCXLocator.from_course_locator(ccx.course_id, unicode(ccx.id)) + ccx_locator = CCXLocator.from_course_locator(ccx.course_id, six.text_type(ccx.id)) try: course = get_course_by_id(ccx_locator) except Http404: - log.error('Could not migrate access for CCX course: %s', unicode(ccx_locator)) + log.error('Could not migrate access for CCX course: %s', six.text_type(ccx_locator)) else: coach = User.objects.get(id=ccx.coach.id) allow_access(course, coach, 'ccx_coach', send_email=False) revoke_access(course, coach, 'staff', send_email=False) log.info( 'The CCX coach of CCX %s has been switched from "Staff" to "CCX Coach".', - unicode(ccx_locator) + six.text_type(ccx_locator) ) class Migration(migrations.Migration): diff --git a/lms/djangoapps/ccx/migrations/0006_set_display_name_as_override.py b/lms/djangoapps/ccx/migrations/0006_set_display_name_as_override.py index ff7ca5d64ea4943a50cd05a7518d65a5b71a6c59..89f8503e0eb7c5c41caca4428f96b4a99246492a 100644 --- a/lms/djangoapps/ccx/migrations/0006_set_display_name_as_override.py +++ b/lms/djangoapps/ccx/migrations/0006_set_display_name_as_override.py @@ -2,6 +2,7 @@ # Generated by Django 1.11.15 on 2018-08-31 18:13 from __future__ import unicode_literals +from __future__ import absolute_import from django.db import migrations from django.http import Http404