diff --git a/cms/envs/bok_choy.auth.json b/cms/envs/bok_choy.auth.json index b5b94b7b80..0fe4d2b236 100644 --- a/cms/envs/bok_choy.auth.json +++ b/cms/envs/bok_choy.auth.json @@ -72,7 +72,7 @@ "OPTIONS": { "collection": "modulestore", "db": "test", - "default_class": "xmodule.hidden_block.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenBlock", "fs_root": "** OVERRIDDEN **", "host": [ "localhost" @@ -86,7 +86,7 @@ "ENGINE": "xmodule.modulestore.xml.XMLModuleStore", "OPTIONS": { "data_dir": "** OVERRIDDEN **", - "default_class": "xmodule.hidden_block.HiddenDescriptor" + "default_class": "xmodule.hidden_block.HiddenBlock" } } ] diff --git a/cms/envs/bok_choy.yml b/cms/envs/bok_choy.yml index 657bedd74a..baf6a5a22d 100644 --- a/cms/envs/bok_choy.yml +++ b/cms/envs/bok_choy.yml @@ -105,14 +105,14 @@ MODULESTORE: OPTIONS: collection: modulestore db: test - default_class: xmodule.hidden_block.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenBlock fs_root: '** OVERRIDDEN **' host: [localhost] port: 27017 render_template: common.djangoapps.edxmako.shortcuts.render_to_string - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml - OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenDescriptor} + OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenBlock} # We need to test different scenarios, following setting effectively disbale rate limiting PASSWORD_RESET_IP_RATE: '1/s' PASSWORD_RESET_EMAIL_RATE: '1/s' diff --git a/cms/envs/bok_choy_docker.auth.json b/cms/envs/bok_choy_docker.auth.json index c3e87580eb..7d280406d0 100644 --- a/cms/envs/bok_choy_docker.auth.json +++ b/cms/envs/bok_choy_docker.auth.json @@ -72,7 +72,7 @@ "OPTIONS": { "collection": "modulestore", "db": "test", - "default_class": "xmodule.hidden_block.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenBlock", "fs_root": "** OVERRIDDEN **", "host": [ "edx.devstack.mongo" @@ -86,7 +86,7 @@ "ENGINE": "xmodule.modulestore.xml.XMLModuleStore", "OPTIONS": { "data_dir": "** OVERRIDDEN **", - "default_class": "xmodule.hidden_block.HiddenDescriptor" + "default_class": "xmodule.hidden_block.HiddenBlock" } } ] diff --git a/cms/envs/bok_choy_docker.yml b/cms/envs/bok_choy_docker.yml index 82b7614ebf..a942704314 100644 --- a/cms/envs/bok_choy_docker.yml +++ b/cms/envs/bok_choy_docker.yml @@ -105,14 +105,14 @@ MODULESTORE: OPTIONS: collection: modulestore db: test - default_class: xmodule.hidden_block.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenBlock fs_root: '** OVERRIDDEN **' host: [edx.devstack.mongo] port: 27017 render_template: common.djangoapps.edxmako.shortcuts.render_to_string - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml - OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenDescriptor} + OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenBlock} SECRET_KEY: '' SERVER_EMAIL: devops@example.com SESSION_COOKIE_DOMAIN: null diff --git a/cms/envs/common.py b/cms/envs/common.py index 1d326f34cf..8973738887 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1005,7 +1005,7 @@ MODULESTORE = { 'ENGINE': 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore', 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': DATA_DIR, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } @@ -1015,7 +1015,7 @@ MODULESTORE = { 'ENGINE': 'xmodule.modulestore.mongo.DraftMongoModuleStore', 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': DATA_DIR, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/cms/envs/devstack-experimental.yml b/cms/envs/devstack-experimental.yml index cc824e5ef0..2f5a11dbf2 100644 --- a/cms/envs/devstack-experimental.yml +++ b/cms/envs/devstack-experimental.yml @@ -379,7 +379,7 @@ MODULESTORE: ENGINE: xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore NAME: split OPTIONS: - default_class: xmodule.hidden_block.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenBlock fs_root: /edx/var/edxapp/data render_template: common.djangoapps.edxmako.shortcuts.render_to_string - DOC_STORE_CONFIG: @@ -399,7 +399,7 @@ MODULESTORE: ENGINE: xmodule.modulestore.mongo.DraftMongoModuleStore NAME: draft OPTIONS: - default_class: xmodule.hidden_block.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenBlock fs_root: /edx/var/edxapp/data render_template: common.djangoapps.edxmako.shortcuts.render_to_string ORA2_FILE_PREFIX: default_env-default_deployment/ora2 diff --git a/cms/envs/test.py b/cms/envs/test.py index 31753437f3..e856034d08 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -101,7 +101,7 @@ BLOCK_STRUCTURES_SETTINGS['PRUNING_ACTIVE'] = True update_module_store_settings( MODULESTORE, module_store_options={ - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': TEST_ROOT / "data", }, doc_store_settings={ diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index 4983a642c1..2696cc219a 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -2602,7 +2602,7 @@ class TestDisabledXBlockTypes(ModuleStoreTestCase): def test_get_item(self): course = CourseFactory() - self._verify_descriptor('video', course, 'HiddenDescriptorWithMixins') + self._verify_descriptor('video', course, 'HiddenBlockWithMixins') def test_dynamic_updates(self): """Tests that the list of disabled xblocks can dynamically update.""" @@ -2615,7 +2615,7 @@ class TestDisabledXBlockTypes(ModuleStoreTestCase): # Now simulate a new request cache. self.store.request_cache.data.clear() - self._verify_descriptor('problem', course, 'HiddenDescriptorWithMixins', item_usage_id) + self._verify_descriptor('problem', course, 'HiddenBlockWithMixins', item_usage_id) def _verify_descriptor(self, category, course, descriptor, item_id=None): """ diff --git a/lms/envs/bok_choy.yml b/lms/envs/bok_choy.yml index ca4fb816a3..53675e6e56 100644 --- a/lms/envs/bok_choy.yml +++ b/lms/envs/bok_choy.yml @@ -196,14 +196,14 @@ MODULESTORE: OPTIONS: collection: modulestore db: test - default_class: xmodule.hidden_block.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenBlock fs_root: '** OVERRIDDEN **' host: [localhost] port: 27017 render_template: common.djangoapps.edxmako.shortcuts.render_to_string - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml - OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenDescriptor} + OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenBlock} # We need to test different scenarios, following setting effectively disbale rate limiting PASSWORD_RESET_IP_RATE: '1/s' PASSWORD_RESET_EMAIL_RATE: '1/s' diff --git a/lms/envs/bok_choy_docker.yml b/lms/envs/bok_choy_docker.yml index bff2876939..5431910e05 100644 --- a/lms/envs/bok_choy_docker.yml +++ b/lms/envs/bok_choy_docker.yml @@ -118,14 +118,14 @@ MODULESTORE: OPTIONS: collection: modulestore db: test - default_class: xmodule.hidden_block.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenBlock fs_root: '** OVERRIDDEN **' host: [edx.devstack.mongo] port: 27017 render_template: common.djangoapps.edxmako.shortcuts.render_to_string - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml - OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenDescriptor} + OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenBlock} PASSWORD_RESET_SUPPORT_LINK: https://support.example.com/password-reset-help.html REGISTRATION_EXTENSION_FORM: openedx.core.djangoapps.user_api.tests.test_helpers.TestCaseForm REGISTRATION_EXTRA_FIELDS: {city: hidden, country: required, gender: optional, goals: optional, diff --git a/lms/envs/common.py b/lms/envs/common.py index a4a6473ab6..94ca721bd6 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1604,7 +1604,7 @@ MODULESTORE = { 'ENGINE': 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore', 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': DATA_DIR, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } @@ -1614,7 +1614,7 @@ MODULESTORE = { 'ENGINE': 'xmodule.modulestore.mongo.DraftMongoModuleStore', 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': DATA_DIR, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/lms/envs/devstack-experimental.yml b/lms/envs/devstack-experimental.yml index c0c9afc01f..0e554cdd9a 100644 --- a/lms/envs/devstack-experimental.yml +++ b/lms/envs/devstack-experimental.yml @@ -419,7 +419,7 @@ MODULESTORE: ENGINE: xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore NAME: split OPTIONS: - default_class: xmodule.hidden_block.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenBlock fs_root: /edx/var/edxapp/data render_template: common.djangoapps.edxmako.shortcuts.render_to_string - DOC_STORE_CONFIG: @@ -439,7 +439,7 @@ MODULESTORE: ENGINE: xmodule.modulestore.mongo.DraftMongoModuleStore NAME: draft OPTIONS: - default_class: xmodule.hidden_block.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenBlock fs_root: /edx/var/edxapp/data render_template: common.djangoapps.edxmako.shortcuts.render_to_string OAUTH_DELETE_EXPIRED: true diff --git a/setup.py b/setup.py index 4519b24f93..3a6670c041 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ XBLOCKS = [ "discuss = xmodule.template_block:TranslateCustomTagBlock", "discussion = xmodule.discussion_block:DiscussionXBlock", "error = xmodule.error_block:ErrorBlock", - "hidden = xmodule.hidden_block:HiddenDescriptor", + "hidden = xmodule.hidden_block:HiddenBlock", "html = xmodule.html_block:HtmlBlock", "image = xmodule.template_block:TranslateCustomTagBlock", "library = xmodule.library_root_xblock:LibraryRoot", diff --git a/xmodule/hidden_block.py b/xmodule/hidden_block.py index 0ed8a10ec7..0d5c288d75 100644 --- a/xmodule/hidden_block.py +++ b/xmodule/hidden_block.py @@ -13,7 +13,7 @@ from xmodule.x_module import ( @XBlock.needs("i18n") -class HiddenDescriptor( +class HiddenBlock( RawMixin, XmlMixin, XModuleToXBlockMixin, @@ -22,9 +22,6 @@ class HiddenDescriptor( """ XBlock class loaded by the runtime when another XBlock type has been disabled or an unknown XBlock type is included in a course import. - - The class name includes 'Descriptor' because this used to be an XModule and the class path is specified in the - modulestore config in a number of places. """ HIDDEN = True has_author_view = True diff --git a/xmodule/modulestore/mongo/base.py b/xmodule/modulestore/mongo/base.py index 5f9abf6f93..a8fa670e47 100644 --- a/xmodule/modulestore/mongo/base.py +++ b/xmodule/modulestore/mongo/base.py @@ -523,9 +523,9 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo module_path, _, class_name = default_class.rpartition('.') try: class_ = getattr(import_module(module_path), class_name) - except ImportError: + except (ImportError, AttributeError): fallback_module_path = "xmodule.hidden_block" - fallback_class_name = "HiddenDescriptor" + fallback_class_name = "HiddenBlock" log.exception( "Failed to import the default store class. " f"Falling back to {fallback_module_path}.{fallback_class_name}" diff --git a/xmodule/modulestore/split_mongo/split.py b/xmodule/modulestore/split_mongo/split.py index 159642c136..4f814986c0 100644 --- a/xmodule/modulestore/split_mongo/split.py +++ b/xmodule/modulestore/split_mongo/split.py @@ -658,9 +658,9 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase): module_path, __, class_name = default_class.rpartition('.') try: class_ = getattr(import_module(module_path), class_name) - except ImportError: + except (ImportError, AttributeError): fallback_module_path = "xmodule.hidden_block" - fallback_class_name = "HiddenDescriptor" + fallback_class_name = "HiddenBlock" log.exception( "Failed to import the default store class. " f"Falling back to {fallback_module_path}.{fallback_class_name}" diff --git a/xmodule/modulestore/tests/django_utils.py b/xmodule/modulestore/tests/django_utils.py index bb0a717620..ebbc6eec65 100644 --- a/xmodule/modulestore/tests/django_utils.py +++ b/xmodule/modulestore/tests/django_utils.py @@ -76,7 +76,7 @@ def mixed_store_config(data_dir, mappings, store_order=None, modulestore_options store_order = [StoreConstructors.draft, StoreConstructors.split] options = { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': data_dir, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/xmodule/modulestore/tests/test_mixed_modulestore.py b/xmodule/modulestore/tests/test_mixed_modulestore.py index 16417cf29c..0f32988962 100644 --- a/xmodule/modulestore/tests/test_mixed_modulestore.py +++ b/xmodule/modulestore/tests/test_mixed_modulestore.py @@ -74,7 +74,7 @@ class CommonMixedModuleStoreSetup(CourseComparisonTest): COLLECTION = 'modulestore' ASSET_COLLECTION = 'assetstore' FS_ROOT = DATA_DIR - DEFAULT_CLASS = 'xmodule.hidden_block.HiddenDescriptor' + DEFAULT_CLASS = 'xmodule.hidden_block.HiddenBlock' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': '' MONGO_COURSEID = 'MITx/999/2013_Spring' diff --git a/xmodule/modulestore/tests/test_modulestore_settings.py b/xmodule/modulestore/tests/test_modulestore_settings.py index b071908ad5..0f843bdefc 100644 --- a/xmodule/modulestore/tests/test_modulestore_settings.py +++ b/xmodule/modulestore/tests/test_modulestore_settings.py @@ -28,7 +28,7 @@ class ModuleStoreSettingsMigration(TestCase): "ENGINE": "xmodule.modulestore.xml.XMLModuleStore", "OPTIONS": { "data_dir": "directory", - "default_class": "xmodule.hidden_block.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenBlock", }, "DOC_STORE_CONFIG": {}, } @@ -40,7 +40,7 @@ class ModuleStoreSettingsMigration(TestCase): "OPTIONS": { "collection": "modulestore", "db": "edxapp", - "default_class": "xmodule.hidden_block.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenBlock", "fs_root": mkdtemp_clean(), "host": "localhost", "password": "password", @@ -64,7 +64,7 @@ class ModuleStoreSettingsMigration(TestCase): "OPTIONS": { "collection": "modulestore", "db": "test", - "default_class": "xmodule.hidden_block.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenBlock", } }, "default": { @@ -79,7 +79,7 @@ class ModuleStoreSettingsMigration(TestCase): "ENGINE": "xmodule.modulestore.xml.XMLModuleStore", "OPTIONS": { "data_dir": "directory", - "default_class": "xmodule.hidden_block.HiddenDescriptor" + "default_class": "xmodule.hidden_block.HiddenBlock" }, "DOC_STORE_CONFIG": {} } @@ -99,7 +99,7 @@ class ModuleStoreSettingsMigration(TestCase): 'ENGINE': 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore', 'DOC_STORE_CONFIG': {}, 'OPTIONS': { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': "fs_root", 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } @@ -109,7 +109,7 @@ class ModuleStoreSettingsMigration(TestCase): 'ENGINE': 'xmodule.modulestore.mongo.draft.DraftModuleStore', 'DOC_STORE_CONFIG': {}, 'OPTIONS': { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': "fs_root", 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/xmodule/modulestore/tests/test_mongo.py b/xmodule/modulestore/tests/test_mongo.py index 1f733b7822..bfdbfc8056 100644 --- a/xmodule/modulestore/tests/test_mongo.py +++ b/xmodule/modulestore/tests/test_mongo.py @@ -48,7 +48,7 @@ DB = 'test_mongo_%s' % uuid4().hex[:5] COLLECTION = 'modulestore' ASSET_COLLECTION = 'assetstore' FS_ROOT = DATA_DIR # TODO (vshnayder): will need a real fs_root for testing load_item -DEFAULT_CLASS = 'xmodule.hidden_block.HiddenDescriptor' +DEFAULT_CLASS = 'xmodule.hidden_block.HiddenBlock' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': '' diff --git a/xmodule/modulestore/tests/test_split_modulestore.py b/xmodule/modulestore/tests/test_split_modulestore.py index 3ff698c4ac..56525f907b 100644 --- a/xmodule/modulestore/tests/test_split_modulestore.py +++ b/xmodule/modulestore/tests/test_split_modulestore.py @@ -67,7 +67,7 @@ class SplitModuleTest(unittest.TestCase): 'collection': 'modulestore', } modulestore_options = { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': tempdir.mkdtemp_clean(), 'xblock_mixins': (InheritanceMixin, XModuleMixin, EditInfoMixin) } diff --git a/xmodule/modulestore/tests/test_split_w_old_mongo.py b/xmodule/modulestore/tests/test_split_w_old_mongo.py index d01fefb377..e53a198411 100644 --- a/xmodule/modulestore/tests/test_split_w_old_mongo.py +++ b/xmodule/modulestore/tests/test_split_w_old_mongo.py @@ -43,7 +43,7 @@ class SplitWMongoCourseBootstrapper(unittest.TestCase): } modulestore_options = { - 'default_class': 'xmodule.hidden_block.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenBlock', 'fs_root': '', 'render_template': mock.Mock(return_value=""), 'xblock_mixins': (InheritanceMixin, XModuleMixin) diff --git a/xmodule/modulestore/tests/utils.py b/xmodule/modulestore/tests/utils.py index 93acc17a22..18bd5b54b1 100644 --- a/xmodule/modulestore/tests/utils.py +++ b/xmodule/modulestore/tests/utils.py @@ -342,7 +342,7 @@ class XmlModulestoreBuilder(StoreBuilderBase): modulestore = XMLModuleStore( DATA_DIR, course_ids=course_ids, - default_class='xmodule.hidden_block.HiddenDescriptor', + default_class='xmodule.hidden_block.HiddenBlock', xblock_mixins=XBLOCK_MIXINS, ) diff --git a/xmodule/modulestore/xml.py b/xmodule/modulestore/xml.py index b965872b4f..d621d6c477 100644 --- a/xmodule/modulestore/xml.py +++ b/xmodule/modulestore/xml.py @@ -337,9 +337,9 @@ class XMLModuleStore(ModuleStoreReadBase): module_path, _, class_name = default_class.rpartition('.') try: class_ = getattr(import_module(module_path), class_name) - except ImportError: + except (ImportError, AttributeError): fallback_module_path = "xmodule.hidden_block" - fallback_class_name = "HiddenDescriptor" + fallback_class_name = "HiddenBlock" log.exception( "Failed to import the default store class. " f"Falling back to {fallback_module_path}.{fallback_class_name}" diff --git a/xmodule/modulestore/xml_importer.py b/xmodule/modulestore/xml_importer.py index d79dc412b2..89bb855067 100644 --- a/xmodule/modulestore/xml_importer.py +++ b/xmodule/modulestore/xml_importer.py @@ -260,7 +260,7 @@ class ImportManager: def __init__( self, store, user_id, data_dir, source_dirs=None, - default_class='xmodule.hidden_block.HiddenDescriptor', + default_class='xmodule.hidden_block.HiddenBlock', load_error_modules=True, static_content_store=None, target_id=None, verbose=False, do_import_static=True, do_import_python_lib=True, @@ -1229,7 +1229,7 @@ def validate_course_policy(module_store, course_id): def perform_xlint( # lint-amnesty, pylint: disable=missing-function-docstring data_dir, source_dirs, - default_class='xmodule.hidden_block.HiddenDescriptor', + default_class='xmodule.hidden_block.HiddenBlock', load_error_modules=True, xblock_mixins=(LocationMixin, XModuleMixin)): err_cnt = 0