Skip to content
Snippets Groups Projects
Commit 39563c32 authored by Calen Pennington's avatar Calen Pennington
Browse files

Make staff view work w/ pure xblocks (that only have a descriptor system)

parent a620cc00
No related branches found
No related tags found
No related merge requests found
......@@ -173,9 +173,9 @@ def add_staff_debug_info(user, block, view, frag, context): # pylint: disable=u
histogram = None
render_histogram = False
if settings.FEATURES.get('ENABLE_LMS_MIGRATION'):
if settings.FEATURES.get('ENABLE_LMS_MIGRATION') and hasattr(block.runtime, 'filestore'):
[filepath, filename] = getattr(block, 'xml_attributes', {}).get('filename', ['', None])
osfs = block.system.filestore
osfs = block.runtime.filestore
if filename is not None and osfs.exists(filename):
# if original, unmangled filename exists then use it (github
# doesn't like symlinks)
......
......@@ -141,6 +141,10 @@ class XModuleMixin(XBlockMixin):
default=None
)
@property
def system(self):
return self.runtime
@property
def course_id(self):
return self.runtime.course_id
......@@ -400,7 +404,6 @@ class XModule(XModuleMixin, HTMLSnippet, XBlock): # pylint: disable=abstract-me
self.descriptor = descriptor
super(XModule, self).__init__(*args, **kwargs)
self._loaded_children = None
self.system = self.runtime
self.runtime.xmodule_instance = self
def __unicode__(self):
......@@ -634,7 +637,6 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
XModuleDescriptor.__init__ takes the same arguments as xblock.core:XBlock.__init__
"""
super(XModuleDescriptor, self).__init__(*args, **kwargs)
self.system = self.runtime
# update_version is the version which last updated this xblock v prev being the penultimate updater
# leaving off original_version since it complicates creation w/o any obv value yet and is computable
# by following previous until None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment