Remove ModuleStoreEnum.Type.xml
This commit is contained in:
@@ -29,10 +29,6 @@ class TestArgParsing(unittest.TestCase):
|
||||
with self.assertRaises(CommandError):
|
||||
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):
|
||||
errstring = "No user 99 found"
|
||||
with self.assertRaisesRegexp(CommandError, errstring):
|
||||
|
||||
@@ -164,8 +164,7 @@ def replace_static_urls(text, data_directory=None, course_id=None, static_asset_
|
||||
return original
|
||||
# if we're running with a MongoBacked store course_namespace is not None, then use studio style urls
|
||||
elif (not static_asset_path) \
|
||||
and course_id \
|
||||
and modulestore().get_modulestore_type(course_id) != ModuleStoreEnum.Type.xml:
|
||||
and course_id:
|
||||
# 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)
|
||||
|
||||
|
||||
@@ -649,7 +649,6 @@ def dashboard(request):
|
||||
show_email_settings_for = frozenset(
|
||||
enrollment.course_id for enrollment in course_enrollments if (
|
||||
settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] and
|
||||
modulestore().get_modulestore_type(enrollment.course_id) != ModuleStoreEnum.Type.xml and
|
||||
CourseAuthorization.instructor_email_enabled(enrollment.course_id)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -55,7 +55,6 @@ class ModuleStoreEnum(object):
|
||||
"""
|
||||
split = 'split'
|
||||
mongo = 'mongo'
|
||||
xml = 'xml'
|
||||
|
||||
class RevisionOption(object):
|
||||
"""
|
||||
|
||||
@@ -1991,11 +1991,8 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
|
||||
self.assertEquals(store.get_modulestore_type(), store_type)
|
||||
|
||||
# verify store used for creating a course
|
||||
try:
|
||||
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)
|
||||
except NotImplementedError:
|
||||
self.assertEquals(store_type, ModuleStoreEnum.Type.xml)
|
||||
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)
|
||||
|
||||
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
|
||||
def test_default_store(self, default_ms):
|
||||
|
||||
@@ -31,10 +31,6 @@ class TestXMLModuleStore(unittest.TestCase):
|
||||
"""
|
||||
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())
|
||||
def test_unicode_chars_in_xml_content(self):
|
||||
# edX/full/6.002_Spring_2012 has non-ASCII chars, and during
|
||||
|
||||
@@ -875,7 +875,7 @@ class XMLModuleStore(ModuleStoreReadBase):
|
||||
Args:
|
||||
course_key: just for signature compatibility
|
||||
"""
|
||||
return ModuleStoreEnum.Type.xml
|
||||
return None #ModuleStoreEnum.Type.xml
|
||||
|
||||
def get_courses_for_wiki(self, wiki_slug, **kwargs):
|
||||
"""
|
||||
@@ -893,7 +893,7 @@ class XMLModuleStore(ModuleStoreReadBase):
|
||||
|
||||
Returns the course count
|
||||
"""
|
||||
return {ModuleStoreEnum.Type.xml: True}
|
||||
return {'xml': True}
|
||||
|
||||
@contextmanager
|
||||
def branch_setting(self, branch_setting, course_id=None): # pylint: disable=unused-argument
|
||||
|
||||
@@ -279,9 +279,7 @@ class CourseExportManager(ExportManager):
|
||||
policy = {'course/' + courselike.location.name: own_metadata(courselike)}
|
||||
course_policy.write(dumps(policy, cls=EdxJSONEncoder, sort_keys=True, indent=4))
|
||||
|
||||
# xml backed courses don't support drafts!
|
||||
if courselike.runtime.modulestore.get_modulestore_type() != ModuleStoreEnum.Type.xml:
|
||||
_export_drafts(self.modulestore, self.courselike_key, export_fs, xml_centric_courselike_key)
|
||||
_export_drafts(self.modulestore, self.courselike_key, export_fs, xml_centric_courselike_key)
|
||||
|
||||
|
||||
class LibraryExportManager(ExportManager):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -13,7 +13,7 @@ from xmodule.modulestore import ModuleStoreEnum
|
||||
def course_image_url(course):
|
||||
"""Try to look up the image url for the course. If it's not found,
|
||||
log an error and return the dead link"""
|
||||
if course.static_asset_path or modulestore().get_modulestore_type(course.id) == ModuleStoreEnum.Type.xml:
|
||||
if course.static_asset_path:
|
||||
# If we are a static course with the course_image attribute
|
||||
# set different than the default, return that path so that
|
||||
# courses can use custom course image paths, otherwise just
|
||||
|
||||
@@ -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
|
||||
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
|
||||
is_mongo_course = modulestore().get_modulestore_type(block.location.course_key) != ModuleStoreEnum.Type.xml
|
||||
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
|
||||
edit_link = "//" + settings.CMS_BASE + '/container/' + unicode(block.location)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user