Remove ModuleStoreEnum.Type.xml
This commit is contained in:
@@ -100,11 +100,4 @@ class CourseAuthorizationAdminForm(forms.ModelForm):
|
||||
msg += 'Please recheck that you have supplied a valid course id.'
|
||||
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
|
||||
|
||||
@@ -453,10 +453,8 @@ def get_studio_url(course, page):
|
||||
Args:
|
||||
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
|
||||
if is_studio_course and is_mongo_course:
|
||||
if course.course_edit_method == "Studio":
|
||||
studio_link = get_cms_course_link(course, page)
|
||||
return studio_link
|
||||
|
||||
|
||||
@@ -491,23 +491,7 @@ class Courses(SysadminDashboardView):
|
||||
escape(str(err))
|
||||
)
|
||||
|
||||
is_xml_course = (modulestore().get_modulestore_type(course_key) == ModuleStoreEnum.Type.xml)
|
||||
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:
|
||||
if course_found:
|
||||
# delete course that is stored with mongodb backend
|
||||
self.def_ms.delete_course(course.id, request.user.id)
|
||||
# don't delete user permission groups, though
|
||||
|
||||
@@ -66,10 +66,9 @@ def bulk_email_is_enabled_for_course(course_id):
|
||||
"""
|
||||
|
||||
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)
|
||||
|
||||
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 False
|
||||
|
||||
@@ -159,19 +159,15 @@ class XBlockGetParentTest(LmsXBlockMixinTestCase):
|
||||
"""
|
||||
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):
|
||||
with self.store.default_store(modulestore_type):
|
||||
|
||||
# setting up our own local course tree here, since it needs to be
|
||||
# created with the correct modulestore type.
|
||||
|
||||
if modulestore_type == 'xml':
|
||||
course_key = self.store.make_course_key('edX', 'toy', '2012_Fall')
|
||||
else:
|
||||
course_key = ToyCourseFactory.create(run='2012_Fall_copy').id
|
||||
course_key = ToyCourseFactory.create().id
|
||||
course = self.store.get_course(course_key)
|
||||
|
||||
self.assertIsNone(course.get_parent())
|
||||
|
||||
def recurse(parent):
|
||||
|
||||
Reference in New Issue
Block a user