Commit d2c6101a by Calen Pennington Committed by Zia Fazal

Set xmodule_runtime on all XModule-like things (including pure XBlocks using the XModuleMixin)

Expose xmodule_runtime as .runtime if it's set (otherwise, fall back to
the supplied runtime). This causes all blocks to act like XModules when
they have a ModuleSystem, and like XModuleDescriptors if they only have
a DescriptorSystem.
parent 94d34cb7
...@@ -1187,9 +1187,8 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # p ...@@ -1187,9 +1187,8 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # p
return super(DescriptorSystem, self).render(block, view_name, context) return super(DescriptorSystem, self).render(block, view_name, context)
def handler_url(self, block, handler_name, suffix='', query='', thirdparty=False): def handler_url(self, block, handler_name, suffix='', query='', thirdparty=False):
xmodule_runtime = getattr(block, 'xmodule_runtime', None) if block.xmodule_runtime is not None:
if xmodule_runtime is not None: return block.xmodule_runtime.handler_url(block, handler_name, suffix, query, thirdparty)
return xmodule_runtime.handler_url(block, handler_name, suffix, query, thirdparty)
else: else:
# Currently, Modulestore is responsible for instantiating DescriptorSystems # Currently, Modulestore is responsible for instantiating DescriptorSystems
# This means that LMS/CMS don't have a way to define a subclass of DescriptorSystem # This means that LMS/CMS don't have a way to define a subclass of DescriptorSystem
...@@ -1201,9 +1200,8 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # p ...@@ -1201,9 +1200,8 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # p
""" """
See :meth:`xblock.runtime.Runtime:local_resource_url` for documentation. See :meth:`xblock.runtime.Runtime:local_resource_url` for documentation.
""" """
xmodule_runtime = getattr(block, 'xmodule_runtime', None) if block.xmodule_runtime is not None:
if xmodule_runtime is not None: return block.xmodule_runtime.local_resource_url(block, uri)
return xmodule_runtime.local_resource_url(block, uri)
else: else:
# Currently, Modulestore is responsible for instantiating DescriptorSystems # Currently, Modulestore is responsible for instantiating DescriptorSystems
# This means that LMS/CMS don't have a way to define a subclass of DescriptorSystem # This means that LMS/CMS don't have a way to define a subclass of DescriptorSystem
...@@ -1221,9 +1219,8 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # p ...@@ -1221,9 +1219,8 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime): # p
""" """
See :meth:`xblock.runtime.Runtime:publish` for documentation. See :meth:`xblock.runtime.Runtime:publish` for documentation.
""" """
xmodule_runtime = getattr(block, 'xmodule_runtime', None) if block.xmodule_runtime is not None:
if xmodule_runtime is not None: return block.xmodule_runtime.publish(block, event_type, event)
return xmodule_runtime.publish(block, event_type, event)
def add_block_as_child_node(self, block, node): def add_block_as_child_node(self, block, node):
child = etree.SubElement(node, "unknown") child = etree.SubElement(node, "unknown")
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
-e git+https://github.com/pmitros/django-pyfs.git@d175715e0fe3367ec0f1ee429c242d603f6e8b10#egg=djpyfs -e git+https://github.com/pmitros/django-pyfs.git@d175715e0fe3367ec0f1ee429c242d603f6e8b10#egg=djpyfs
# Our libraries: # Our libraries:
-e git+https://github.com/edx/XBlock.git@81a6d713c98d4914af96a0ca624ee7fa4903625e#egg=XBlock -e git+https://github.com/edx/XBlock.git@246811773c67a84fdb17614a8e9f7ec7b1890574#egg=XBlock
-e git+https://github.com/edx/codejail.git@66dd5a45e5072666ff9a70c768576e9ffd1daa4b#egg=codejail -e git+https://github.com/edx/codejail.git@66dd5a45e5072666ff9a70c768576e9ffd1daa4b#egg=codejail
-e git+https://github.com/edx/diff-cover.git@9a44ae21369662a7d06bfc5111875fc0d119e03b#egg=diff_cover -e git+https://github.com/edx/diff-cover.git@9a44ae21369662a7d06bfc5111875fc0d119e03b#egg=diff_cover
-e git+https://github.com/edx/js-test-tool.git@v0.1.5#egg=js_test_tool -e git+https://github.com/edx/js-test-tool.git@v0.1.5#egg=js_test_tool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment