Make staff view work w/ pure xblocks (that only have a descriptor system)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user