refactor: delete ModuleSystem's file_data property
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=<value> 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 <paulo@opencraft.com> Co-authored-by: DubeySandeep <dubeysandeep.in@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user