Studio render XBlockAside views
PLAT-280
This commit is contained in:
@@ -356,6 +356,10 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
|
||||
"""
|
||||
return xblock._edit_info.get('published_date')
|
||||
|
||||
def applicable_aside_types(self, block):
|
||||
# "old" mongo does support asides yet
|
||||
return []
|
||||
|
||||
|
||||
# The only thing using this w/ wildcards is contentstore.mongo for asset retrieval
|
||||
def location_to_query(location, wildcard=True, tag='i4x'):
|
||||
|
||||
@@ -28,7 +28,7 @@ class TestAsidesXmlStore(TestCase):
|
||||
"""
|
||||
Test Asides sourced from xml store
|
||||
"""
|
||||
@patch('xmodule.x_module.descriptor_global_applicable_aside_types', lambda block: ['test_aside'])
|
||||
@patch('xmodule.modulestore.xml.ImportSystem.applicable_aside_types', lambda self, block: ['test_aside'])
|
||||
@XBlockAside.register_temp_plugin(AsideTestType, 'test_aside')
|
||||
def test_xml_aside(self):
|
||||
"""
|
||||
|
||||
@@ -203,6 +203,6 @@ class TestLibraries(MixedSplitTestCase):
|
||||
message = u"Hello world"
|
||||
hello_render = lambda _, context: Fragment(message)
|
||||
with patch('xmodule.html_module.HtmlDescriptor.author_view', hello_render, create=True):
|
||||
with patch('xmodule.x_module.descriptor_global_applicable_aside_types', lambda block: []):
|
||||
with patch('xmodule.x_module.DescriptorSystem.applicable_aside_types', lambda self, block: []):
|
||||
result = library.render(AUTHOR_VIEW, context)
|
||||
self.assertIn(message, result.content)
|
||||
|
||||
@@ -1133,15 +1133,6 @@ def descriptor_global_local_resource_url(block, uri): # pylint: disable=invalid
|
||||
raise NotImplementedError("Applications must monkey-patch this function before using local_resource_url for studio_view")
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def descriptor_global_applicable_aside_types(block): # pylint: disable=unused-argument
|
||||
"""
|
||||
See :meth:`xblock.runtime.Runtime.applicable_aside_types`.
|
||||
"""
|
||||
raise NotImplementedError("Applications must monkey-patch this function before using applicable_aside_types"
|
||||
" from a DescriptorSystem.")
|
||||
|
||||
|
||||
class MetricsMixin(object):
|
||||
"""
|
||||
Mixin for adding metric logging for render and handle methods in the DescriptorSystem and ModuleSystem.
|
||||
@@ -1320,14 +1311,11 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # p
|
||||
"""
|
||||
See :meth:`xblock.runtime.Runtime:applicable_aside_types` for documentation.
|
||||
"""
|
||||
potential_set = set(super(DescriptorSystem, self).applicable_aside_types(block))
|
||||
if getattr(block, 'xmodule_runtime', None) is not None:
|
||||
return block.xmodule_runtime.applicable_aside_types(block)
|
||||
else:
|
||||
# Currently, Modulestore is responsible for instantiating DescriptorSystems
|
||||
# This means that LMS/CMS don't have a way to define a subclass of DescriptorSystem
|
||||
# that implements the correct get_asides. So, for now, instead, we will reference a
|
||||
# global function that the application can override.
|
||||
return descriptor_global_applicable_aside_types(block)
|
||||
application_set = set(block.xmodule_runtime.applicable_aside_types(block))
|
||||
return list(potential_set.intersection(application_set))
|
||||
return list(potential_set)
|
||||
|
||||
def resource_url(self, resource):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user