From 0f858835f171ffe2e1cad841f31799655182433e Mon Sep 17 00:00:00 2001 From: 0x29a Date: Thu, 23 Jun 2022 15:20:32 +0200 Subject: [PATCH] refactor: delete ModuleSystem's `file_data` property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are many `field_data` usages in the platform. Let's categorize them and determine, which are related to this change and in what way. - ModuleSystem's argument. This is what we're removing. - Runtime.field_data. Directly related, as Runtime is ModuleSystem's superclass. Analysis below this list is centered around this. - XBlock.field_data. Not related anymore. Runtime.construct_xblock was passing runtime's field_data to the XBlock's constructor, but that was ~8 years ago. - DescriptorSystem.field_data. Not related anymore. field_data has been removed from the constructor long time ago, but you still can see its ancestors instantiated with field_data= here and there. It's important to note, that it has been added here in the first place, because field_data was required in Runtime. - DummySystem, CachingDescriptorSystem, ImportSystem. Not related anymore. All these classes inherit MakoDescriptorSystem, which inherits DescriptorSystem itself. So, see the previous item. - PreviewModuleSystem, TestModuleSystem, LmsModuleSystem — ModuleSystem's ancestors. Directly related. Basing on that, the only necessary check is to search for ModuleSystem's ancestors using `field_data` or `_deprecated_per_instance_field_data`. As there are no such cases, it's safe to remove `field_data`. Co-authored-by: Paulo Viadanna Co-authored-by: DubeySandeep --- xmodule/x_module.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/xmodule/x_module.py b/xmodule/x_module.py index 88027f9a98..13f36c14f4 100644 --- a/xmodule/x_module.py +++ b/xmodule/x_module.py @@ -1668,7 +1668,6 @@ class ModuleSystem(MetricsMixin, ConfigurableFragmentWrapper, ModuleSystemShim, publish=None, course_id=None, error_descriptor_class=None, - field_data=None, **kwargs, ): """ @@ -1692,15 +1691,11 @@ class ModuleSystem(MetricsMixin, ConfigurableFragmentWrapper, ModuleSystemShim, publish(event) - A function that allows XModules to publish events (such as grade changes) error_descriptor_class - The class to use to render XModules with errors - - field_data - the `FieldData` to use for backing XBlock storage. """ - # Usage_store is unused, and field_data is often supplanted with an - # explicit field_data during construct_xblock. kwargs.setdefault('id_reader', getattr(descriptor_runtime, 'id_reader', OpaqueKeyReader())) kwargs.setdefault('id_generator', getattr(descriptor_runtime, 'id_generator', AsideKeyGenerator())) - super().__init__(field_data=field_data, **kwargs) + super().__init__(**kwargs) self.STATIC_URL = static_url self.track_function = track_function