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

@@ -6,6 +6,7 @@ from django.conf import settings
from opaque_keys import InvalidKeyError
from opaque_keys.edx.locator import CourseKey
from six import text_type
from xmodule.assetstore.assetmgr import AssetManager
from xmodule.contentstore.content import StaticContent
from xmodule.contentstore.django import contentstore
@@ -77,7 +78,7 @@ def clean_course_id(model_form, is_required=True):
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

@@ -7,6 +7,7 @@ import unittest
from django.conf import settings
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from six import text_type
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase
@@ -56,7 +57,7 @@ class TestCrowdsourceHinter(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
cls.course_url = reverse(
'courseware_section',
kwargs={
'course_id': cls.course.id.to_deprecated_string(),
'course_id': text_type(cls.course.id),
'chapter': 'Overview',
'section': 'Welcome',
}
@@ -78,9 +79,8 @@ class TestCrowdsourceHinter(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
if xblock_name is None:
xblock_name = TestCrowdsourceHinter.XBLOCK_NAMES[0]
return reverse('xblock_handler', kwargs={
'course_id': self.course.id.to_deprecated_string(),
'usage_id': quote_slashes(self.course.id.make_usage_key('crowdsourcehinter', xblock_name).
to_deprecated_string()),
'course_id': text_type(self.course.id),
'usage_id': quote_slashes(text_type(self.course.id.make_usage_key('crowdsourcehinter', xblock_name))),
'handler': handler,
'suffix': ''
})

View File

@@ -16,6 +16,7 @@ from ddt import data, ddt
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase
from nose.plugins.attrib import attr
from six import text_type
from openedx.core.lib.url_utils import quote_slashes
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@@ -67,7 +68,7 @@ class TestRecommender(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
cls.course_url = reverse(
'courseware_section',
kwargs={
'course_id': cls.course.id.to_deprecated_string(),
'course_id': text_type(cls.course.id),
'chapter': 'Overview',
'section': 'Welcome',
}
@@ -129,8 +130,8 @@ class TestRecommender(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
if xblock_name is None:
xblock_name = TestRecommender.XBLOCK_NAMES[0]
return reverse('xblock_handler', kwargs={
'course_id': self.course.id.to_deprecated_string(),
'usage_id': quote_slashes(self.course.id.make_usage_key('recommender', xblock_name).to_deprecated_string()),
'course_id': text_type(self.course.id),
'usage_id': quote_slashes(text_type(self.course.id.make_usage_key('recommender', xblock_name))),
'handler': handler,
'suffix': ''
})