refactor: Delete XModule classes (#30262)

Removes XModule, XModuleDescriptor, ProxyAttribute classes and their usages.
This commit is contained in:
Demid
2022-05-10 20:09:11 +03:00
committed by GitHub
parent 0ef57eb136
commit a4ec4c1b8e
18 changed files with 63 additions and 1105 deletions

View File

@@ -32,8 +32,7 @@ from xmodule.seq_module import SequenceBlock # lint-amnesty, pylint: disable=wr
from xmodule.util.xmodule_django import add_webpack_to_fragment # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.vertical_block import VerticalBlock # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.x_module import ( # lint-amnesty, pylint: disable=wrong-import-order
PREVIEW_VIEWS, STUDENT_VIEW, STUDIO_VIEW,
XModule, XModuleDescriptor, shim_xmodule_js,
PREVIEW_VIEWS, STUDENT_VIEW, STUDIO_VIEW, shim_xmodule_js,
)
log = logging.getLogger(__name__)
@@ -114,7 +113,7 @@ def wrap_xblock(
if view == STUDENT_VIEW and getattr(block, 'HIDDEN', False):
css_classes.append('is-hidden')
if isinstance(block, (XModule, XModuleDescriptor)) or getattr(block, 'uses_xmodule_styles_setup', False):
if getattr(block, 'uses_xmodule_styles_setup', False):
if view in PREVIEW_VIEWS:
# The block is acting as an XModule
css_classes.append('xmodule_display')
@@ -124,10 +123,6 @@ def wrap_xblock(
css_classes.append('xmodule_' + markupsafe.escape(class_name))
if isinstance(block, (XModule, XModuleDescriptor)):
data['type'] = block.js_module_name
shim_xmodule_js(frag, block.js_module_name)
if frag.js_init_fn:
data['init'] = frag.js_init_fn
data['runtime-class'] = runtime_class
@@ -155,10 +150,6 @@ def wrap_xblock(
else:
template_context['js_init_parameters'] = ""
if isinstance(block, (XModule, XModuleDescriptor)):
# Add the webpackified asset tags
add_webpack_to_fragment(frag, class_name)
return wrap_fragment(frag, render_to_string('xblock_wrapper.html', template_context))