Commit 70d5ec6e by cahrens

Make it clear that get_course_for_item is only a helper method in mongo modulestore.

parent e0aa46ab
...@@ -681,7 +681,7 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -681,7 +681,7 @@ class MongoModuleStore(ModuleStoreBase):
# we should remove this once we can break this reference from the course to static tabs # we should remove this once we can break this reference from the course to static tabs
# TODO move this special casing to app tier (similar to attaching new element to parent) # TODO move this special casing to app tier (similar to attaching new element to parent)
if location.category == 'static_tab': if location.category == 'static_tab':
course = self.get_course_for_item(location) course = self._get_course_for_item(location)
existing_tabs = course.tabs or [] existing_tabs = course.tabs or []
existing_tabs.append({ existing_tabs.append({
'type': 'static_tab', 'type': 'static_tab',
...@@ -701,7 +701,7 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -701,7 +701,7 @@ class MongoModuleStore(ModuleStoreBase):
self.modulestore_update_signal.send(self, modulestore=self, course_id=course_id, self.modulestore_update_signal.send(self, modulestore=self, course_id=course_id,
location=location) location=location)
def get_course_for_item(self, location, depth=0): def _get_course_for_item(self, location, depth=0):
''' '''
VS[compat] VS[compat]
cdodge: for a given Xmodule, return the course that it belongs to cdodge: for a given Xmodule, return the course that it belongs to
...@@ -790,7 +790,7 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -790,7 +790,7 @@ class MongoModuleStore(ModuleStoreBase):
# we should remove this once we can break this reference from the course to static tabs # we should remove this once we can break this reference from the course to static tabs
loc = Location(location) loc = Location(location)
if loc.category == 'static_tab': if loc.category == 'static_tab':
course = self.get_course_for_item(loc) course = self._get_course_for_item(loc)
existing_tabs = course.tabs or [] existing_tabs = course.tabs or []
for tab in existing_tabs: for tab in existing_tabs:
if tab.get('url_slug') == loc.name: if tab.get('url_slug') == loc.name:
...@@ -818,7 +818,7 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -818,7 +818,7 @@ class MongoModuleStore(ModuleStoreBase):
# we should remove this once we can break this reference from the course to static tabs # we should remove this once we can break this reference from the course to static tabs
if location.category == 'static_tab': if location.category == 'static_tab':
item = self.get_item(location) item = self.get_item(location)
course = self.get_course_for_item(item.location) course = self._get_course_for_item(item.location)
existing_tabs = course.tabs or [] existing_tabs = course.tabs or []
course.tabs = [tab for tab in existing_tabs if tab.get('url_slug') != location.name] course.tabs = [tab for tab in existing_tabs if tab.get('url_slug') != location.name]
# Save the updates to the course to the MongoKeyValueStore # Save the updates to the course to the MongoKeyValueStore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment