Commit 77abfbf4 by chrisndodge

Merge pull request #813 from edx/bugfix/ichuang/course-tabs-None

bugfix: Course static_tabs importing with display_name = "None"
parents 4fbf23b6 493d8d26
...@@ -127,3 +127,9 @@ class ContentStoreImportNoStaticTest(ModuleStoreTestCase): ...@@ -127,3 +127,9 @@ class ContentStoreImportNoStaticTest(ModuleStoreTestCase):
handouts = module_store.get_item(Location(['i4x', 'edX', 'toy', 'html', 'toyhtml', None])) handouts = module_store.get_item(Location(['i4x', 'edX', 'toy', 'html', 'toyhtml', None]))
self.assertIn('/static/', handouts.data) self.assertIn('/static/', handouts.data)
def test_tab_name_imports_correctly(self):
module_store, content_store, course, course_location = self.load_test_import_course()
print "course tabs = {0}".format(course.tabs)
self.assertEqual(course.tabs[2]['name'],'Syllabus')
...@@ -794,7 +794,7 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -794,7 +794,7 @@ class MongoModuleStore(ModuleStoreBase):
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:
tab['name'] = metadata.get('display_name') tab['name'] = tab.get('name', metadata.get('display_name'))
break break
course.tabs = existing_tabs course.tabs = existing_tabs
# 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