diff --git a/cms/djangoapps/contentstore/config/forms.py b/cms/djangoapps/contentstore/config/forms.py index a0c39e2fbc..b233e4f498 100644 --- a/cms/djangoapps/contentstore/config/forms.py +++ b/cms/djangoapps/contentstore/config/forms.py @@ -8,6 +8,7 @@ from django import forms from contentstore.config.models import CourseNewAssetsPageFlag from opaque_keys import InvalidKeyError +from six import text_type from xmodule.modulestore.django import modulestore from opaque_keys.edx.locator import CourseLocator @@ -31,7 +32,7 @@ class CourseNewAssetsPageAdminForm(forms.ModelForm): raise forms.ValidationError(msg) if not modulestore().has_course(course_key): - msg = u'Course not found. Entered course id was: "{0}". '.format(course_key.to_deprecated_string()) + msg = u'Course not found. Entered course id was: "{0}". '.format(text_type(course_key)) raise forms.ValidationError(msg) return course_key diff --git a/cms/djangoapps/contentstore/config/models.py b/cms/djangoapps/contentstore/config/models.py index 7ca42ea726..ace57e0a77 100644 --- a/cms/djangoapps/contentstore/config/models.py +++ b/cms/djangoapps/contentstore/config/models.py @@ -4,6 +4,7 @@ controlling the new assets page. """ from config_models.models import ConfigurationModel from django.db.models import BooleanField +from six import text_type from openedx.core.djangoapps.xmodule_django.models import CourseKeyField @@ -74,4 +75,4 @@ class CourseNewAssetsPageFlag(ConfigurationModel): if self.enabled: not_en = "" # pylint: disable=no-member - return u"Course '{}': New assets page {}Enabled".format(self.course_id.to_deprecated_string(), not_en) + return u"Course '{}': New assets page {}Enabled".format(text_type(self.course_id), not_en) diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index 72a17b051e..d13768929a 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -10,6 +10,7 @@ from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from opaque_keys.edx.keys import CourseKey, UsageKey from pytz import UTC +from six import text_type from django_comment_common.models import assign_default_role from django_comment_common.utils import seed_permissions_roles @@ -126,8 +127,8 @@ def get_lms_link_for_item(location, preview=False): return u"//{lms_base}/courses/{course_key}/jump_to/{location}".format( lms_base=lms_base, - course_key=location.course_key.to_deprecated_string(), - location=location.to_deprecated_string(), + course_key=text_type(location.course_key), + location=text_type(location), ) diff --git a/cms/templates/widgets/metadata-edit.html b/cms/templates/widgets/metadata-edit.html index 673038f1da..ad53db6ccf 100644 --- a/cms/templates/widgets/metadata-edit.html +++ b/cms/templates/widgets/metadata-edit.html @@ -5,8 +5,9 @@ import hashlib import copy import json + from six import text_type from xmodule.modulestore import EdxJSONEncoder - hlskey = hashlib.md5(module.location.to_deprecated_string().encode('utf-8')).hexdigest() + hlskey = hashlib.md5(text_type(module.location).encode('utf-8')).hexdigest() %> ## js templates diff --git a/cms/templates/widgets/source-edit.html b/cms/templates/widgets/source-edit.html index 6998193a31..ac58fe9ceb 100644 --- a/cms/templates/widgets/source-edit.html +++ b/cms/templates/widgets/source-edit.html @@ -1,6 +1,7 @@ <% import hashlib - hlskey = hashlib.md5(module.location.to_deprecated_string()).hexdigest() + from six import text_type + hlskey = hashlib.md5(text_type(module.location)).hexdigest() %>