From 0d98521943bd9fc6564b93eed5c768d521f6d8af Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Wed, 19 Oct 2022 14:33:36 +0200 Subject: [PATCH 01/12] refactor: remove unused dummy_track function --- xmodule/x_module.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xmodule/x_module.py b/xmodule/x_module.py index 65cf099208..a461e6b957 100644 --- a/xmodule/x_module.py +++ b/xmodule/x_module.py @@ -205,10 +205,6 @@ class AsideKeyGenerator(IdGenerator): raise NotImplementedError("Specific Modulestores must provide implementations of create_definition") -def dummy_track(_event_type, _event): - pass - - class HTMLSnippet: """ A base class defining an interface for an object that is able to present an From fd61f1fff6c47a10c0e863269c4f05ccc7a7f0e2 Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Wed, 19 Oct 2022 15:39:48 +0200 Subject: [PATCH 02/12] refactor: remove unused XMLEditingDescriptor --- xmodule/editing_module.py | 12 ------------ xmodule/raw_module.py | 1 - 2 files changed, 13 deletions(-) diff --git a/xmodule/editing_module.py b/xmodule/editing_module.py index b8bf994f64..3866130525 100644 --- a/xmodule/editing_module.py +++ b/xmodule/editing_module.py @@ -98,18 +98,6 @@ class TabsEditingDescriptor(TabsEditingMixin, MakoModuleDescriptor): # lint-amn pass # lint-amnesty, pylint: disable=unnecessary-pass -class XMLEditingDescriptor(EditingDescriptor): # lint-amnesty, pylint: disable=abstract-method - """ - Module that provides a raw editing view of its data as XML. It does not perform - any validation of its definition - """ - - css = {'scss': [resource_string(__name__, 'css/codemirror/codemirror.scss')]} - - js = {'js': [resource_string(__name__, 'js/src/raw/edit/xml.js')]} - js_module_name = "XMLEditingDescriptor" - - class MetadataOnlyEditingDescriptor(EditingDescriptor): # lint-amnesty, pylint: disable=abstract-method """ Module which only provides an editing interface for the metadata, it does diff --git a/xmodule/raw_module.py b/xmodule/raw_module.py index ad033204e4..8201f0b63b 100644 --- a/xmodule/raw_module.py +++ b/xmodule/raw_module.py @@ -4,7 +4,6 @@ import re from lxml import etree from xblock.fields import Scope, String -from xmodule.editing_module import XMLEditingDescriptor # pylint: disable=unused-import from xmodule.xml_module import XmlDescriptor # pylint: disable=unused-import from .exceptions import SerializationError From 6017d0c28b9218ac078626901ba460fbb8e53634 Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Wed, 19 Oct 2022 15:49:54 +0200 Subject: [PATCH 03/12] refactor: remove unused MetadataOnlyEditingDescriptor --- xmodule/editing_module.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/xmodule/editing_module.py b/xmodule/editing_module.py index 3866130525..3b82cc8639 100644 --- a/xmodule/editing_module.py +++ b/xmodule/editing_module.py @@ -98,18 +98,6 @@ class TabsEditingDescriptor(TabsEditingMixin, MakoModuleDescriptor): # lint-amn pass # lint-amnesty, pylint: disable=unnecessary-pass -class MetadataOnlyEditingDescriptor(EditingDescriptor): # lint-amnesty, pylint: disable=abstract-method - """ - Module which only provides an editing interface for the metadata, it does - not expose a UI for editing the module data - """ - - js = {'js': [resource_string(__name__, 'js/src/raw/edit/metadata-only.js')]} - js_module_name = "MetadataOnlyEditingDescriptor" - - mako_template = "widgets/metadata-only-edit.html" - - class JSONEditingDescriptor(EditingDescriptor): # lint-amnesty, pylint: disable=abstract-method """ Module that provides a raw editing view of its data as XML. It does not perform From a1bb30a79246231f97eca41bcdd6b5cd01fb3053 Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Wed, 19 Oct 2022 15:56:26 +0200 Subject: [PATCH 04/12] refactor: remove unused JSONEditingDescriptor Removing js file related to it as well, since it's not being used anywhere, unlike with other removed descriptors. --- xmodule/editing_module.py | 12 ------------ xmodule/js/src/raw/edit/json.js | 32 -------------------------------- 2 files changed, 44 deletions(-) delete mode 100644 xmodule/js/src/raw/edit/json.js diff --git a/xmodule/editing_module.py b/xmodule/editing_module.py index 3b82cc8639..ee84cd27c9 100644 --- a/xmodule/editing_module.py +++ b/xmodule/editing_module.py @@ -96,15 +96,3 @@ class TabsEditingDescriptor(TabsEditingMixin, MakoModuleDescriptor): # lint-amn settings tab in your module descriptor. """ pass # lint-amnesty, pylint: disable=unnecessary-pass - - -class JSONEditingDescriptor(EditingDescriptor): # lint-amnesty, pylint: disable=abstract-method - """ - Module that provides a raw editing view of its data as XML. It does not perform - any validation of its definition - """ - - css = {'scss': [resource_string(__name__, 'css/codemirror/codemirror.scss')]} - - js = {'js': [resource_string(__name__, 'js/src/raw/edit/json.js')]} - js_module_name = "JSONEditingDescriptor" diff --git a/xmodule/js/src/raw/edit/json.js b/xmodule/js/src/raw/edit/json.js deleted file mode 100644 index 2de28c03f7..0000000000 --- a/xmodule/js/src/raw/edit/json.js +++ /dev/null @@ -1,32 +0,0 @@ -// Once generated by CoffeeScript 1.9.3, but now lives as pure JS -/* eslint-disable */ -(function() { - var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; - - this.JSONEditingDescriptor = (function(superClass) { - extend(JSONEditingDescriptor, superClass); - - function JSONEditingDescriptor(element) { - this.element = element; - this.edit_box = CodeMirror.fromTextArea($(".edit-box", this.element)[0], { - mode: { - name: "javascript", - json: true - }, - lineNumbers: true, - lineWrapping: true - }); - } - - JSONEditingDescriptor.prototype.save = function() { - return { - data: JSON.parse(this.edit_box.getValue()) - }; - }; - - return JSONEditingDescriptor; - - })(XModule.Descriptor); - -}).call(this); From 5a3ba5d8c4b7011e73ee46372a1e9f1aaea13d18 Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Thu, 20 Oct 2022 15:31:26 +0200 Subject: [PATCH 05/12] refactor: remove unused EditingDescriptor --- xmodule/editing_module.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xmodule/editing_module.py b/xmodule/editing_module.py index ee84cd27c9..de609729b4 100644 --- a/xmodule/editing_module.py +++ b/xmodule/editing_module.py @@ -46,10 +46,6 @@ class EditingMixin(EditingFields, MakoTemplateBlockBase): return _context -class EditingDescriptor(EditingMixin, MakoModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method - pass - - class TabsEditingMixin(EditingFields, MakoTemplateBlockBase): """ Common code between TabsEditingDescriptor and XBlocks converted from XModules. From 3020f4af53d8ee67a37f3172234da5fbd1ce34e2 Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Thu, 20 Oct 2022 16:10:01 +0200 Subject: [PATCH 06/12] refactor: remove unused attributes and methods of TabsEditingMixin --- xmodule/editing_module.py | 16 ------------- xmodule/tests/test_editing_module.py | 24 ------------------- .../test_files/test_tabseditingdescriptor.css | 4 ---- .../test_tabseditingdescriptor.scss | 4 ---- 4 files changed, 48 deletions(-) delete mode 100644 xmodule/tests/test_files/test_tabseditingdescriptor.css delete mode 100644 xmodule/tests/test_files/test_tabseditingdescriptor.scss diff --git a/xmodule/editing_module.py b/xmodule/editing_module.py index de609729b4..cd1ac32555 100644 --- a/xmodule/editing_module.py +++ b/xmodule/editing_module.py @@ -3,7 +3,6 @@ import logging -from pkg_resources import resource_string from xblock.fields import Scope, String from xmodule.mako_module import MakoModuleDescriptor, MakoTemplateBlockBase @@ -52,9 +51,6 @@ class TabsEditingMixin(EditingFields, MakoTemplateBlockBase): """ mako_template = "widgets/tabs-aggregator.html" - css = {'scss': [resource_string(__name__, 'css/tabs/tabs.scss')]} - js = {'js': [resource_string( - __name__, 'js/src/tabs/tabs-aggregator.js')]} js_module_name = "TabsEditingDescriptor" tabs = [] @@ -67,18 +63,6 @@ class TabsEditingMixin(EditingFields, MakoTemplateBlockBase): }) return _context - @classmethod - def get_css(cls): # lint-amnesty, pylint: disable=missing-function-docstring - # load every tab's css - for tab in cls.tabs: - tab_styles = tab.get('css', {}) - for css_type, css_content in tab_styles.items(): - if css_type in cls.css: - cls.css[css_type].extend(css_content) - else: - cls.css[css_type] = css_content - return cls.css - class TabsEditingDescriptor(TabsEditingMixin, MakoModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method """ diff --git a/xmodule/tests/test_editing_module.py b/xmodule/tests/test_editing_module.py index 0f29595be6..603054844c 100644 --- a/xmodule/tests/test_editing_module.py +++ b/xmodule/tests/test_editing_module.py @@ -28,20 +28,6 @@ class TabsEditingDescriptorTestCase(unittest.TestCase): 'name': "Test_css", 'template': "tabs/codemirror-edit.html", 'current': True, - 'css': { - 'scss': [ - resource_string( - __name__, - 'test_files/test_tabseditingdescriptor.scss' - ) - ], - 'css': [ - resource_string( - __name__, - 'test_files/test_tabseditingdescriptor.css' - ) - ] - } }, { 'name': "Subtitles", @@ -62,16 +48,6 @@ class TabsEditingDescriptorTestCase(unittest.TestCase): field_data=DictFieldData({}), ) - def test_get_css(self): - """test get_css""" - css = self.descriptor.get_css() - current_dir = os.path.dirname(__file__) - test_css_file = os.path.join(current_dir, 'test_files/test_tabseditingdescriptor.scss') - with open(test_css_file) as new_css: - added_css = new_css.read() - assert css['scss'].pop().decode('utf-8') == added_css - assert css['css'].pop().decode('utf-8') == added_css - def test_get_context(self): """"test get_context""" rendered_context = self.descriptor.get_context() diff --git a/xmodule/tests/test_files/test_tabseditingdescriptor.css b/xmodule/tests/test_files/test_tabseditingdescriptor.css deleted file mode 100644 index e56f54b6f5..0000000000 --- a/xmodule/tests/test_files/test_tabseditingdescriptor.css +++ /dev/null @@ -1,4 +0,0 @@ -.supertestclass { - color: red; -} - diff --git a/xmodule/tests/test_files/test_tabseditingdescriptor.scss b/xmodule/tests/test_files/test_tabseditingdescriptor.scss deleted file mode 100644 index e56f54b6f5..0000000000 --- a/xmodule/tests/test_files/test_tabseditingdescriptor.scss +++ /dev/null @@ -1,4 +0,0 @@ -.supertestclass { - color: red; -} - From 995713c6c6cc497b0becc33f1eb4638b1bca3325 Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Thu, 20 Oct 2022 16:15:25 +0200 Subject: [PATCH 07/12] refactor: remove unused TabsEditingDescriptor --- xmodule/editing_module.py | 21 +++-------- xmodule/tests/test_editing_module.py | 54 ---------------------------- 2 files changed, 5 insertions(+), 70 deletions(-) delete mode 100644 xmodule/tests/test_editing_module.py diff --git a/xmodule/editing_module.py b/xmodule/editing_module.py index cd1ac32555..c37ceba907 100644 --- a/xmodule/editing_module.py +++ b/xmodule/editing_module.py @@ -5,7 +5,7 @@ import logging from xblock.fields import Scope, String -from xmodule.mako_module import MakoModuleDescriptor, MakoTemplateBlockBase +from xmodule.mako_module import MakoTemplateBlockBase log = logging.getLogger(__name__) @@ -47,7 +47,10 @@ class EditingMixin(EditingFields, MakoTemplateBlockBase): class TabsEditingMixin(EditingFields, MakoTemplateBlockBase): """ - Common code between TabsEditingDescriptor and XBlocks converted from XModules. + Module that provides a raw editing view of its data and children. It does not + perform any validation on its definition---just passes it along to the browser. + + This class is intended to be used as a mixin. """ mako_template = "widgets/tabs-aggregator.html" @@ -62,17 +65,3 @@ class TabsEditingMixin(EditingFields, MakoTemplateBlockBase): 'data': self.data, }) return _context - - -class TabsEditingDescriptor(TabsEditingMixin, MakoModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method - """ - Module that provides a raw editing view of its data and children. It does not - perform any validation on its definition---just passes it along to the browser. - - This class is intended to be used as a mixin. - - Engine (module_edit.js) wants for metadata editor - template to be always loaded, so don't forget to include - settings tab in your module descriptor. - """ - pass # lint-amnesty, pylint: disable=unnecessary-pass diff --git a/xmodule/tests/test_editing_module.py b/xmodule/tests/test_editing_module.py deleted file mode 100644 index 603054844c..0000000000 --- a/xmodule/tests/test_editing_module.py +++ /dev/null @@ -1,54 +0,0 @@ -""" Tests for editing descriptors""" - - -import logging -import os -import unittest -from unittest.mock import Mock - -from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator -from pkg_resources import resource_string -from xblock.field_data import DictFieldData -from xblock.fields import ScopeIds - -from xmodule.editing_module import TabsEditingDescriptor -from xmodule.tests import get_test_descriptor_system - -log = logging.getLogger(__name__) - - -class TabsEditingDescriptorTestCase(unittest.TestCase): - """ Testing TabsEditingDescriptor""" - - def setUp(self): - super().setUp() - system = get_test_descriptor_system(render_template=Mock()) - self.tabs = [ - { - 'name': "Test_css", - 'template': "tabs/codemirror-edit.html", - 'current': True, - }, - { - 'name': "Subtitles", - 'template': "video/subtitles.html", - }, - { - 'name': "Settings", - 'template': "tabs/video-metadata-edit-tab.html" - } - ] - - TabsEditingDescriptor.tabs = self.tabs - self.descriptor = system.construct_xblock_from_class( - TabsEditingDescriptor, - scope_ids=ScopeIds(None, None, None, - BlockUsageLocator(CourseLocator('org', 'course', 'run', branch='revision'), - 'category', 'name')), - field_data=DictFieldData({}), - ) - - def test_get_context(self): - """"test get_context""" - rendered_context = self.descriptor.get_context() - self.assertListEqual(rendered_context['tabs'], self.tabs) From 98d9e622b4b20a6b456f5f3cedf4e54228f8090f Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Thu, 20 Oct 2022 16:42:14 +0200 Subject: [PATCH 08/12] refactor: remove unused MakoModuleDescriptor --- xmodule/mako_module.py | 14 +------------- xmodule/tests/test_mako_module.py | 25 ------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 xmodule/tests/test_mako_module.py diff --git a/xmodule/mako_module.py b/xmodule/mako_module.py index 977aac2260..83572097fa 100644 --- a/xmodule/mako_module.py +++ b/xmodule/mako_module.py @@ -4,9 +4,8 @@ Code to handle mako templating for XModules and XBlocks. from web_fragments.fragment import Fragment -from xblock.core import XBlock -from .x_module import DescriptorSystem, shim_xmodule_js, XModuleMixin +from .x_module import DescriptorSystem, shim_xmodule_js class MakoDescriptorSystem(DescriptorSystem): # lint-amnesty, pylint: disable=abstract-method @@ -72,14 +71,3 @@ class MakoTemplateBlockBase: ) shim_xmodule_js(fragment, self.js_module_name) return fragment - - -@XBlock.needs("i18n") -class MakoModuleDescriptor(MakoTemplateBlockBase, XModuleMixin): # pylint: disable=abstract-method - """ - Mixin to use for XModule descriptors. - """ - resources_dir = None - - def get_html(self): - return self.studio_view(None).content diff --git a/xmodule/tests/test_mako_module.py b/xmodule/tests/test_mako_module.py deleted file mode 100644 index cbfb642290..0000000000 --- a/xmodule/tests/test_mako_module.py +++ /dev/null @@ -1,25 +0,0 @@ -""" Test mako_module.py """ - - -from unittest import TestCase -from unittest.mock import Mock - -import pytest - -from xmodule.mako_module import MakoModuleDescriptor - - -class MakoModuleTest(TestCase): - """ Test MakoModuleDescriptor """ - - def test_render_template_check(self): - mock_system = Mock() - mock_system.render_template = None - - with pytest.raises(TypeError): - MakoModuleDescriptor(mock_system, {}) - - del mock_system.render_template - - with pytest.raises(TypeError): - MakoModuleDescriptor(mock_system, {}) From 8336c7f9b52c6612ae57eb4aa0508fe8bdf034d9 Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Fri, 21 Oct 2022 11:43:48 +0200 Subject: [PATCH 09/12] refactor: remove unused StudioEditableModule --- xmodule/library_root_xblock.py | 4 ++-- xmodule/studio_editable.py | 5 +---- xmodule/tests/test_studio_editable.py | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/xmodule/library_root_xblock.py b/xmodule/library_root_xblock.py index 32581330aa..97ec88aed6 100644 --- a/xmodule/library_root_xblock.py +++ b/xmodule/library_root_xblock.py @@ -8,7 +8,7 @@ import logging from web_fragments.fragment import Fragment from xblock.core import XBlock from xblock.fields import Boolean, List, Scope, String -from xmodule.studio_editable import StudioEditableModule +from xmodule.studio_editable import StudioEditableBlock log = logging.getLogger(__name__) @@ -87,7 +87,7 @@ class LibraryRoot(XBlock): child_context['show_preview'] = self.show_children_previews child_context['can_edit_visibility'] = False child = self.runtime.get_block(child_key) - child_view_name = StudioEditableModule.get_preview_view_name(child) + child_view_name = StudioEditableBlock.get_preview_view_name(child) if str(child.location) == force_render: child_context['show_preview'] = True diff --git a/xmodule/studio_editable.py b/xmodule/studio_editable.py index f222851dc3..287d72bab7 100644 --- a/xmodule/studio_editable.py +++ b/xmodule/studio_editable.py @@ -25,7 +25,7 @@ class StudioEditableBlock(XBlockMixin): if can_reorder: context['reorderable_items'].add(child.location) context['can_add'] = can_add - rendered_child = child.render(StudioEditableModule.get_preview_view_name(child), context) + rendered_child = child.render(StudioEditableBlock.get_preview_view_name(child), context) fragment.add_fragment_resources(rendered_child) contents.append({ @@ -48,9 +48,6 @@ class StudioEditableBlock(XBlockMixin): return AUTHOR_VIEW if has_author_view(block) else STUDENT_VIEW -StudioEditableModule = StudioEditableBlock - - def has_author_view(descriptor): """ Returns True if the xmodule linked to the descriptor supports "author_view". diff --git a/xmodule/tests/test_studio_editable.py b/xmodule/tests/test_studio_editable.py index cd985ccaff..f697cf8249 100644 --- a/xmodule/tests/test_studio_editable.py +++ b/xmodule/tests/test_studio_editable.py @@ -1,5 +1,5 @@ """ -Tests for StudioEditableModule. +Tests for StudioEditableBlock. """ @@ -7,9 +7,9 @@ from xmodule.tests.test_vertical import BaseVerticalBlockTest from xmodule.x_module import AUTHOR_VIEW -class StudioEditableModuleTestCase(BaseVerticalBlockTest): +class StudioEditableBlockTestCase(BaseVerticalBlockTest): """ - Class containing StudioEditableModule tests. + Class containing StudioEditableBlock tests. """ def test_render_reorderable_children(self): From 205a7b25cf62ff07a18b56635552a3a1cb8a718f Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Fri, 21 Oct 2022 16:14:31 +0200 Subject: [PATCH 10/12] refactor: remove unused TimeInfo --- xmodule/tests/test_fields.py | 10 --------- xmodule/timeinfo.py | 42 ------------------------------------ 2 files changed, 52 deletions(-) delete mode 100644 xmodule/timeinfo.py diff --git a/xmodule/tests/test_fields.py b/xmodule/tests/test_fields.py index 50796dbd54..1e928fb1b3 100644 --- a/xmodule/tests/test_fields.py +++ b/xmodule/tests/test_fields.py @@ -7,7 +7,6 @@ import pytest from pytz import UTC from xmodule.fields import Date, RelativeTime, Timedelta -from xmodule.timeinfo import TimeInfo class DateTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring @@ -117,15 +116,6 @@ class TimedeltaTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing TimedeltaTest.delta.to_json(datetime.timedelta(days=1, hours=12, minutes=59, seconds=59)) -class TimeInfoTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring - - def test_time_info(self): - due_date = datetime.datetime(2000, 4, 14, 10, tzinfo=UTC) - grace_pd_string = '1 day 12 hours 59 minutes 59 seconds' - timeinfo = TimeInfo(due_date, grace_pd_string) - assert timeinfo.close_date == (due_date + Timedelta().from_json(grace_pd_string)) - - class RelativeTimeTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring delta = RelativeTime() diff --git a/xmodule/timeinfo.py b/xmodule/timeinfo.py deleted file mode 100644 index f88ed4cb3b..0000000000 --- a/xmodule/timeinfo.py +++ /dev/null @@ -1,42 +0,0 @@ -# lint-amnesty, pylint: disable=missing-module-docstring - -import logging - -from xmodule.fields import Timedelta - -log = logging.getLogger(__name__) - - -class TimeInfo: - """ - This is a simple object that calculates and stores datetime information for an XModule - based on the due date and the grace period string - - So far it parses out three different pieces of time information: - self.display_due_date - the 'official' due date that gets displayed to students - self.grace_period - the length of the grace period - self.close_date - the real due date - - """ - _delta_standin = Timedelta() - - def __init__(self, due_date, grace_period_string_or_timedelta): - if due_date is not None: - self.display_due_date = due_date - - else: - self.display_due_date = None - - if grace_period_string_or_timedelta is not None and self.display_due_date: - if isinstance(grace_period_string_or_timedelta, str): - try: - self.grace_period = TimeInfo._delta_standin.from_json(grace_period_string_or_timedelta) - except: - log.error(f"Error parsing the grace period {grace_period_string_or_timedelta}") - raise - else: - self.grace_period = grace_period_string_or_timedelta - self.close_date = self.display_due_date + self.grace_period - else: - self.grace_period = None - self.close_date = self.display_due_date From bbfa975e802566e52d9e6545ae9e42c02756506f Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Fri, 21 Oct 2022 16:23:13 +0200 Subject: [PATCH 11/12] refactor: remove unused assetstore exceptions --- xmodule/assetstore/assetmgr.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/xmodule/assetstore/assetmgr.py b/xmodule/assetstore/assetmgr.py index fb5e830bb2..4f50730d9d 100644 --- a/xmodule/assetstore/assetmgr.py +++ b/xmodule/assetstore/assetmgr.py @@ -16,27 +16,6 @@ Note: Hotfix (PLAT-734) No asset calls find_asset_metadata, and directly accesse from xmodule.contentstore.django import contentstore -class AssetException(Exception): - """ - Base exception class for all exceptions related to assets. - """ - pass # lint-amnesty, pylint: disable=unnecessary-pass - - -class AssetMetadataNotFound(AssetException): - """ - Thrown when no asset metadata is present in the course modulestore for the particular asset requested. - """ - pass # lint-amnesty, pylint: disable=unnecessary-pass - - -class AssetMetadataFoundTemporary(AssetException): - """ - TEMPORARY: Thrown if asset metadata is actually found in the course modulestore. - """ - pass # lint-amnesty, pylint: disable=unnecessary-pass - - class AssetManager: """ Manager for saving/loading course assets. From 3e9437cc4acb5c0da3ed84659fb5ee1aec7c3278 Mon Sep 17 00:00:00 2001 From: Maxim Beder Date: Fri, 28 Oct 2022 11:11:28 +0200 Subject: [PATCH 12/12] refactor: remove unused TabsEditingMixin --- xmodule/editing_module.py | 22 ---------------------- xmodule/video_module/video_module.py | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/xmodule/editing_module.py b/xmodule/editing_module.py index c37ceba907..ce450c56bd 100644 --- a/xmodule/editing_module.py +++ b/xmodule/editing_module.py @@ -43,25 +43,3 @@ class EditingMixin(EditingFields, MakoTemplateBlockBase): # Add our specific template information (the raw data body) _context.update({'data': self.data}) return _context - - -class TabsEditingMixin(EditingFields, MakoTemplateBlockBase): - """ - Module that provides a raw editing view of its data and children. It does not - perform any validation on its definition---just passes it along to the browser. - - This class is intended to be used as a mixin. - """ - - mako_template = "widgets/tabs-aggregator.html" - js_module_name = "TabsEditingDescriptor" - tabs = [] - - def get_context(self): - _context = MakoTemplateBlockBase.get_context(self) - _context.update({ - 'tabs': self.tabs, - 'html_id': self.location.html_id(), # element_id - 'data': self.data, - }) - return _context diff --git a/xmodule/video_module/video_module.py b/xmodule/video_module/video_module.py index a7aad184ff..7ee3b0c0f8 100644 --- a/xmodule/video_module/video_module.py +++ b/xmodule/video_module/video_module.py @@ -35,8 +35,9 @@ from openedx.core.djangoapps.video_pipeline.config.waffle import DEPRECATE_YOUTU from openedx.core.lib.cache_utils import request_cached from openedx.core.lib.license import LicenseMixin from xmodule.contentstore.content import StaticContent -from xmodule.editing_module import EditingMixin, TabsEditingMixin +from xmodule.editing_module import EditingMixin from xmodule.exceptions import NotFoundError +from xmodule.mako_module import MakoTemplateBlockBase from xmodule.modulestore.inheritance import InheritanceKeyValueStore, own_metadata from xmodule.raw_module import EmptyDataRawMixin from xmodule.validation import StudioValidation, StudioValidationMessage @@ -112,9 +113,8 @@ EXPORT_IMPORT_STATIC_DIR = 'static' @XBlock.needs('mako', 'user') class VideoBlock( VideoFields, VideoTranscriptsMixin, VideoStudioViewHandlers, VideoStudentViewHandlers, - TabsEditingMixin, EmptyDataRawMixin, XmlMixin, EditingMixin, - XModuleToXBlockMixin, HTMLSnippet, ResourceTemplates, XModuleMixin, - LicenseMixin): + EmptyDataRawMixin, XmlMixin, EditingMixin, XModuleToXBlockMixin, HTMLSnippet, + ResourceTemplates, XModuleMixin, LicenseMixin): """ XML source example: