diff --git a/cms/djangoapps/contentstore/features/course-export.py b/cms/djangoapps/contentstore/features/course-export.py index 2f428d5bd2..cdc6ea13bf 100644 --- a/cms/djangoapps/contentstore/features/course-export.py +++ b/cms/djangoapps/contentstore/features/course-export.py @@ -54,6 +54,10 @@ def i_click_on_error_dialog(step): course_key = SlashSeparatedCourseKey("MITx", "999", "Robot_Super_Course") # we don't know the actual ID of the vertical. So just check that we did go to a # vertical page in the course (there should only be one). - vertical_usage_key = course_key.make_usage_key("vertical", "") + vertical_usage_key = course_key.make_usage_key("vertical", None) vertical_url = reverse_usage_url('unit_handler', vertical_usage_key) + # Remove the trailing "/None" from the URL - we don't know the course ID, so we just want to + # check that we visited a vertical URL. + if vertical_url.endswith("/None"): + vertical_url = vertical_url[:-5] assert_equal(1, world.browser.url.count(vertical_url)) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index f97a180333..43c230e68f 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -1479,7 +1479,7 @@ class ContentStoreTest(ContentStoreTestCase): content_store = contentstore() # Use conditional_and_poll, as it's got an image already - import_from_xml( + __, courses = import_from_xml( self.store, self.user.id, 'common/test/data/', @@ -1487,7 +1487,7 @@ class ContentStoreTest(ContentStoreTestCase): static_content_store=content_store ) - course = self.store.get_courses()[0] + course = courses[0] # Make sure the course image is set to the right place self.assertEqual(course.course_image, 'images_course_image.jpg') diff --git a/cms/djangoapps/contentstore/views/item.py b/cms/djangoapps/contentstore/views/item.py index a3794afd1b..7dca8ee24a 100644 --- a/cms/djangoapps/contentstore/views/item.py +++ b/cms/djangoapps/contentstore/views/item.py @@ -318,11 +318,11 @@ def _save_item(user, usage_key, data=None, children=None, metadata=None, nullout data = old_content['data'] if 'data' in old_content else None if children is not None: - children_usage_keys = [ - UsageKey.from_string(child) - for child - in children - ] + children_usage_keys = [] + for child in children: + child_usage_key = UsageKey.from_string(child) + child_usage_key = child_usage_key.replace(course_key=modulestore().fill_in_run(child_usage_key.course_key)) + children_usage_keys.append(child_usage_key) existing_item.children = children_usage_keys # also commit any metadata which might have been passed along diff --git a/common/lib/xmodule/xmodule/contentstore/content.py b/common/lib/xmodule/xmodule/contentstore/content.py index 37608b4182..3bb0a5e5d5 100644 --- a/common/lib/xmodule/xmodule/contentstore/content.py +++ b/common/lib/xmodule/xmodule/contentstore/content.py @@ -111,7 +111,7 @@ class StaticContent(object): """ Generate an AssetKey for the given path (old c4x/org/course/asset/name syntax) """ - # TODO OpaqueKey - change to from_string once opaque keys lands + # TODO OpaqueKeys after opaque keys deprecation is working # return AssetLocation.from_string(path) return AssetLocation.from_deprecated_string(path) diff --git a/common/lib/xmodule/xmodule/contentstore/mongo.py b/common/lib/xmodule/xmodule/contentstore/mongo.py index 5bebde339f..d3f9bdb288 100644 --- a/common/lib/xmodule/xmodule/contentstore/mongo.py +++ b/common/lib/xmodule/xmodule/contentstore/mongo.py @@ -43,11 +43,6 @@ class MongoContentStore(ContentStore): self.fs_files = _db[bucket + ".files"] # the underlying collection GridFS uses - # TODO OpaqueKey - remove after merge of opaque urls - if not hasattr(AssetLocation, 'deprecated'): - setattr(AssetLocation, 'deprecated', True) - setattr(SlashSeparatedCourseKey, 'deprecated', True) - def drop_database(self): """ Only for use by test code. Removes the database!