Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions xmodule/assetstore/assetmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,6 @@
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.
Expand Down
91 changes: 1 addition & 90 deletions xmodule/editing_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

import logging

from pkg_resources import resource_string
from xblock.fields import Scope, String

from xmodule.mako_module import MakoModuleDescriptor, MakoTemplateBlockBase
from xmodule.mako_module import MakoTemplateBlockBase

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -44,91 +43,3 @@ def get_context(self):
# Add our specific template information (the raw data body)
_context.update({'data': self.data})
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.
"""

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 = []

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

@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
"""
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


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
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
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"
32 changes: 0 additions & 32 deletions xmodule/js/src/raw/edit/json.js

This file was deleted.

4 changes: 2 additions & 2 deletions xmodule/library_root_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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__)

Expand Down Expand Up @@ -87,7 +87,7 @@ def render_children(self, context, fragment, can_reorder=False, can_add=False):
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
Expand Down
14 changes: 1 addition & 13 deletions xmodule/mako_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@


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
Expand Down Expand Up @@ -72,14 +71,3 @@ def studio_view(self, context): # pylint: disable=unused-argument
)
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
1 change: 0 additions & 1 deletion xmodule/raw_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

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
Expand Down
5 changes: 1 addition & 4 deletions xmodule/studio_editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def render_children(self, context, fragment, can_reorder=False, can_add=False):
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({
Expand All @@ -48,9 +48,6 @@ def get_preview_view_name(block):
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".
Expand Down
78 changes: 0 additions & 78 deletions xmodule/tests/test_editing_module.py

This file was deleted.

10 changes: 0 additions & 10 deletions xmodule/tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
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
Expand Down Expand Up @@ -117,15 +116,6 @@ def test_to_json(self):
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()
Expand Down
4 changes: 0 additions & 4 deletions xmodule/tests/test_files/test_tabseditingdescriptor.css

This file was deleted.

4 changes: 0 additions & 4 deletions xmodule/tests/test_files/test_tabseditingdescriptor.scss

This file was deleted.

25 changes: 0 additions & 25 deletions xmodule/tests/test_mako_module.py

This file was deleted.

6 changes: 3 additions & 3 deletions xmodule/tests/test_studio_editable.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
Tests for StudioEditableModule.
Tests for StudioEditableBlock.
"""


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):
Expand Down
Loading