Make course ids and usage ids opaque to LMS and Studio [partial commit]

This commit updates lms/djangoapps/courseware.

These keys are now objects with a limited interface, and the particular
internal representation is managed by the data storage layer (the
modulestore).

For the LMS, there should be no outward-facing changes to the system.
The keys are, for now, a change to internal representation only. For
Studio, the new serialized form of the keys is used in urls, to allow
for further migration in the future.

Co-Author: Andy Armstrong <andya@edx.org>
Co-Author: Christina Roberts <christina@edx.org>
Co-Author: David Baumgold <db@edx.org>
Co-Author: Diana Huang <dkh@edx.org>
Co-Author: Don Mitchell <dmitchell@edx.org>
Co-Author: Julia Hansbrough <julia@edx.org>
Co-Author: Nimisha Asthagiri <nasthagiri@edx.org>
Co-Author: Sarina Canelake <sarina@edx.org>

[LMS-2370]
This commit is contained in:
Calen Pennington
2014-04-30 10:17:50 -04:00
parent 7852906ce0
commit 9811926d97
45 changed files with 812 additions and 698 deletions

View File

@@ -113,11 +113,10 @@ class SplitTestBase(ModuleStoreTestCase):
resp = self.client.get(reverse(
'courseware_section',
kwargs={'course_id': self.course.id,
kwargs={'course_id': self.course.id.to_deprecated_string(),
'chapter': self.chapter.url_name,
'section': self.sequential.url_name}
))
content = resp.content
# Assert we see the proper icon in the top display
@@ -176,15 +175,15 @@ class TestVertSplitTestVert(SplitTestBase):
display_name="Split test vertical",
)
# pylint: disable=protected-access
c0_url = self.course.location._replace(category="vertical", name="split_test_cond0")
c1_url = self.course.location._replace(category="vertical", name="split_test_cond1")
c0_url = self.course.id.make_usage_key("vertical", "split_test_cond0")
c1_url = self.course.id.make_usage_key("vertical", "split_test_cond1")
split_test = ItemFactory.create(
parent_location=vert1.location,
category="split_test",
display_name="Split test",
user_partition_id='0',
group_id_to_child={"0": c0_url.url(), "1": c1_url.url()},
group_id_to_child={"0": c0_url, "1": c1_url},
)
cond0vert = ItemFactory.create(
@@ -242,15 +241,15 @@ class TestSplitTestVert(SplitTestBase):
# split_test cond 0 = vert <- {video, problem}
# split_test cond 1 = vert <- {video, html}
# pylint: disable=protected-access
c0_url = self.course.location._replace(category="vertical", name="split_test_cond0")
c1_url = self.course.location._replace(category="vertical", name="split_test_cond1")
c0_url = self.course.id.make_usage_key("vertical", "split_test_cond0")
c1_url = self.course.id.make_usage_key("vertical", "split_test_cond1")
split_test = ItemFactory.create(
parent_location=self.sequential.location,
category="split_test",
display_name="Split test",
user_partition_id='0',
group_id_to_child={"0": c0_url.url(), "1": c1_url.url()},
group_id_to_child={"0": c0_url, "1": c1_url},
)
cond0vert = ItemFactory.create(