Commit 971a198f by John Eskew Committed by Clinton Blackburn

Remove ModuleStoreEnum.Type.xml

parent 2380fa3c
...@@ -29,10 +29,6 @@ class TestArgParsing(unittest.TestCase): ...@@ -29,10 +29,6 @@ class TestArgParsing(unittest.TestCase):
with self.assertRaises(CommandError): with self.assertRaises(CommandError):
self.command.handle("foo", "user@foo.org", "org", "course", "run") self.command.handle("foo", "user@foo.org", "org", "course", "run")
def test_xml_store(self):
with self.assertRaises(CommandError):
self.command.handle(ModuleStoreEnum.Type.xml, "user@foo.org", "org", "course", "run")
def test_nonexistent_user_id(self): def test_nonexistent_user_id(self):
errstring = "No user 99 found" errstring = "No user 99 found"
with self.assertRaisesRegexp(CommandError, errstring): with self.assertRaisesRegexp(CommandError, errstring):
......
...@@ -164,8 +164,7 @@ def replace_static_urls(text, data_directory=None, course_id=None, static_asset_ ...@@ -164,8 +164,7 @@ def replace_static_urls(text, data_directory=None, course_id=None, static_asset_
return original return original
# if we're running with a MongoBacked store course_namespace is not None, then use studio style urls # if we're running with a MongoBacked store course_namespace is not None, then use studio style urls
elif (not static_asset_path) \ elif (not static_asset_path) \
and course_id \ and course_id:
and modulestore().get_modulestore_type(course_id) != ModuleStoreEnum.Type.xml:
# first look in the static file pipeline and see if we are trying to reference # first look in the static file pipeline and see if we are trying to reference
# a piece of static content which is in the edx-platform repo (e.g. JS associated with an xmodule) # a piece of static content which is in the edx-platform repo (e.g. JS associated with an xmodule)
......
...@@ -649,7 +649,6 @@ def dashboard(request): ...@@ -649,7 +649,6 @@ def dashboard(request):
show_email_settings_for = frozenset( show_email_settings_for = frozenset(
enrollment.course_id for enrollment in course_enrollments if ( enrollment.course_id for enrollment in course_enrollments if (
settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and
modulestore().get_modulestore_type(enrollment.course_id) != ModuleStoreEnum.Type.xml and
CourseAuthorization.instructor_email_enabled(enrollment.course_id) CourseAuthorization.instructor_email_enabled(enrollment.course_id)
) )
) )
......
...@@ -55,7 +55,6 @@ class ModuleStoreEnum(object): ...@@ -55,7 +55,6 @@ class ModuleStoreEnum(object):
""" """
split = 'split' split = 'split'
mongo = 'mongo' mongo = 'mongo'
xml = 'xml'
class RevisionOption(object): class RevisionOption(object):
""" """
......
...@@ -1991,11 +1991,8 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup): ...@@ -1991,11 +1991,8 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self.assertEquals(store.get_modulestore_type(), store_type) self.assertEquals(store.get_modulestore_type(), store_type)
# verify store used for creating a course # verify store used for creating a course
try: course = self.store.create_course("org", "course{}".format(uuid4().hex[:5]), "run", self.user_id)
course = self.store.create_course("org", "course{}".format(uuid4().hex[:5]), "run", self.user_id) self.assertEquals(course.system.modulestore.get_modulestore_type(), store_type)
self.assertEquals(course.system.modulestore.get_modulestore_type(), store_type)
except NotImplementedError:
self.assertEquals(store_type, ModuleStoreEnum.Type.xml)
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split) @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_default_store(self, default_ms): def test_default_store(self, default_ms):
......
...@@ -31,10 +31,6 @@ class TestXMLModuleStore(unittest.TestCase): ...@@ -31,10 +31,6 @@ class TestXMLModuleStore(unittest.TestCase):
""" """
Test around the XML modulestore Test around the XML modulestore
""" """
def test_xml_modulestore_type(self):
store = XMLModuleStore(DATA_DIR, source_dirs=[])
self.assertEqual(store.get_modulestore_type(), ModuleStoreEnum.Type.xml)
@patch('xmodule.tabs.CourseTabList.initialize_default', Mock()) @patch('xmodule.tabs.CourseTabList.initialize_default', Mock())
def test_unicode_chars_in_xml_content(self): def test_unicode_chars_in_xml_content(self):
# edX/full/6.002_Spring_2012 has non-ASCII chars, and during # edX/full/6.002_Spring_2012 has non-ASCII chars, and during
......
...@@ -875,7 +875,7 @@ class XMLModuleStore(ModuleStoreReadBase): ...@@ -875,7 +875,7 @@ class XMLModuleStore(ModuleStoreReadBase):
Args: Args:
course_key: just for signature compatibility course_key: just for signature compatibility
""" """
return ModuleStoreEnum.Type.xml return None #ModuleStoreEnum.Type.xml
def get_courses_for_wiki(self, wiki_slug, **kwargs): def get_courses_for_wiki(self, wiki_slug, **kwargs):
""" """
...@@ -893,7 +893,7 @@ class XMLModuleStore(ModuleStoreReadBase): ...@@ -893,7 +893,7 @@ class XMLModuleStore(ModuleStoreReadBase):
Returns the course count Returns the course count
""" """
return {ModuleStoreEnum.Type.xml: True} return {'xml': True}
@contextmanager @contextmanager
def branch_setting(self, branch_setting, course_id=None): # pylint: disable=unused-argument def branch_setting(self, branch_setting, course_id=None): # pylint: disable=unused-argument
......
...@@ -279,9 +279,7 @@ class CourseExportManager(ExportManager): ...@@ -279,9 +279,7 @@ class CourseExportManager(ExportManager):
policy = {'course/' + courselike.location.name: own_metadata(courselike)} policy = {'course/' + courselike.location.name: own_metadata(courselike)}
course_policy.write(dumps(policy, cls=EdxJSONEncoder, sort_keys=True, indent=4)) course_policy.write(dumps(policy, cls=EdxJSONEncoder, sort_keys=True, indent=4))
# xml backed courses don't support drafts! _export_drafts(self.modulestore, self.courselike_key, export_fs, xml_centric_courselike_key)
if courselike.runtime.modulestore.get_modulestore_type() != ModuleStoreEnum.Type.xml:
_export_drafts(self.modulestore, self.courselike_key, export_fs, xml_centric_courselike_key)
class LibraryExportManager(ExportManager): class LibraryExportManager(ExportManager):
......
...@@ -100,11 +100,4 @@ class CourseAuthorizationAdminForm(forms.ModelForm): ...@@ -100,11 +100,4 @@ class CourseAuthorizationAdminForm(forms.ModelForm):
msg += 'Please recheck that you have supplied a valid course id.' msg += 'Please recheck that you have supplied a valid course id.'
raise forms.ValidationError(msg) raise forms.ValidationError(msg)
# Now, try and discern if it is a Studio course - HTML editor doesn't work with XML courses
is_studio_course = modulestore().get_modulestore_type(course_key) != ModuleStoreEnum.Type.xml
if not is_studio_course:
msg = "Course Email feature is only available for courses authored in Studio. "
msg += '"{0}" appears to be an XML backed course.'.format(course_key.to_deprecated_string())
raise forms.ValidationError(msg)
return course_key return course_key
...@@ -453,10 +453,8 @@ def get_studio_url(course, page): ...@@ -453,10 +453,8 @@ def get_studio_url(course, page):
Args: Args:
course (CourseDescriptor) course (CourseDescriptor)
""" """
is_studio_course = course.course_edit_method == "Studio"
is_mongo_course = modulestore().get_modulestore_type(course.id) != ModuleStoreEnum.Type.xml
studio_link = None studio_link = None
if is_studio_course and is_mongo_course: if course.course_edit_method == "Studio":
studio_link = get_cms_course_link(course, page) studio_link = get_cms_course_link(course, page)
return studio_link return studio_link
......
...@@ -491,23 +491,7 @@ class Courses(SysadminDashboardView): ...@@ -491,23 +491,7 @@ class Courses(SysadminDashboardView):
escape(str(err)) escape(str(err))
) )
is_xml_course = (modulestore().get_modulestore_type(course_key) == ModuleStoreEnum.Type.xml) if course_found:
if course_found and is_xml_course:
cdir = course.data_dir
self.def_ms.courses.pop(cdir)
# now move the directory (don't actually delete it)
new_dir = "{course_dir}_deleted_{timestamp}".format(
course_dir=cdir,
timestamp=int(time.time())
)
os.rename(settings.DATA_DIR / cdir, settings.DATA_DIR / new_dir)
self.msg += (u"<font color='red'>Deleted "
u"{0} = {1} ({2})</font>".format(
cdir, course.id, course.display_name))
elif course_found and not is_xml_course:
# delete course that is stored with mongodb backend # delete course that is stored with mongodb backend
self.def_ms.delete_course(course.id, request.user.id) self.def_ms.delete_course(course.id, request.user.id)
# don't delete user permission groups, though # don't delete user permission groups, though
......
...@@ -66,10 +66,9 @@ def bulk_email_is_enabled_for_course(course_id): ...@@ -66,10 +66,9 @@ def bulk_email_is_enabled_for_course(course_id):
""" """
bulk_email_enabled_globally = (settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] is True) bulk_email_enabled_globally = (settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] is True)
is_studio_course = (modulestore().get_modulestore_type(course_id) != ModuleStoreEnum.Type.xml)
bulk_email_enabled_for_course = CourseAuthorization.instructor_email_enabled(course_id) bulk_email_enabled_for_course = CourseAuthorization.instructor_email_enabled(course_id)
if bulk_email_enabled_globally and is_studio_course and bulk_email_enabled_for_course: if bulk_email_enabled_globally and bulk_email_enabled_for_course:
return True return True
return False return False
......
...@@ -159,19 +159,15 @@ class XBlockGetParentTest(LmsXBlockMixinTestCase): ...@@ -159,19 +159,15 @@ class XBlockGetParentTest(LmsXBlockMixinTestCase):
""" """
MODULESTORE = TEST_DATA_MIXED_MODULESTORE MODULESTORE = TEST_DATA_MIXED_MODULESTORE
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split, ModuleStoreEnum.Type.xml) @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_parents(self, modulestore_type): def test_parents(self, modulestore_type):
with self.store.default_store(modulestore_type): with self.store.default_store(modulestore_type):
# setting up our own local course tree here, since it needs to be # setting up our own local course tree here, since it needs to be
# created with the correct modulestore type. # created with the correct modulestore type.
if modulestore_type == 'xml': course_key = ToyCourseFactory.create().id
course_key = self.store.make_course_key('edX', 'toy', '2012_Fall')
else:
course_key = ToyCourseFactory.create(run='2012_Fall_copy').id
course = self.store.get_course(course_key) course = self.store.get_course(course_key)
self.assertIsNone(course.get_parent()) self.assertIsNone(course.get_parent())
def recurse(parent): def recurse(parent):
......
...@@ -300,10 +300,9 @@ def add_staff_markup(user, has_instructor_access, disable_staff_debug_info, bloc ...@@ -300,10 +300,9 @@ def add_staff_markup(user, has_instructor_access, disable_staff_debug_info, bloc
# TODO: make this more general, eg use an XModule attribute instead # TODO: make this more general, eg use an XModule attribute instead
if isinstance(block, VerticalBlock) and (not context or not context.get('child_of_vertical', False)): if isinstance(block, VerticalBlock) and (not context or not context.get('child_of_vertical', False)):
# check that the course is a mongo backed Studio course before doing work # check that the course is a mongo backed Studio course before doing work
is_mongo_course = modulestore().get_modulestore_type(block.location.course_key) != ModuleStoreEnum.Type.xml
is_studio_course = block.course_edit_method == "Studio" is_studio_course = block.course_edit_method == "Studio"
if is_studio_course and is_mongo_course: if is_studio_course:
# build edit link to unit in CMS. Can't use reverse here as lms doesn't load cms's urls.py # build edit link to unit in CMS. Can't use reverse here as lms doesn't load cms's urls.py
edit_link = "//" + settings.CMS_BASE + '/container/' + unicode(block.location) edit_link = "//" + settings.CMS_BASE + '/container/' + unicode(block.location)
......
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