PLAT-1873 to_deprecated_string() cleanup part 1

This commit is contained in:
Jeremy Bowman
2018-01-05 16:27:51 -05:00
parent 2580a76016
commit d3d6272d8f
63 changed files with 386 additions and 306 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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),
)

View File

@@ -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

View File

@@ -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()
%>
<section id="hls-modal-${hlskey}" class="upload-modal modal" style="overflow:scroll; background:#ddd; padding: 10px 0;box-shadow: 0 0 5px 0 #555;" >