Make system.xblock_model_data more explicit to fix the problem where error descriptors can't get any data because the schema and the data don't match.
This commit is contained in:
@@ -454,9 +454,9 @@ def preview_module_system(request, preview_id, descriptor):
|
||||
descriptor: An XModuleDescriptor
|
||||
"""
|
||||
|
||||
def preview_model_data(model_data):
|
||||
def preview_model_data(descriptor):
|
||||
return DbModel(
|
||||
SessionKeyValueStore(request, model_data),
|
||||
SessionKeyValueStore(request, descriptor._model_data),
|
||||
descriptor.module_class,
|
||||
preview_id,
|
||||
MongoUsage(preview_id, descriptor.location.url()),
|
||||
|
||||
@@ -31,7 +31,7 @@ i4xs = ModuleSystem(
|
||||
xqueue={'interface':None, 'callback_url':'/', 'default_queuename': 'testqueue', 'waittime': 10},
|
||||
node_path=os.environ.get("NODE_PATH", "/usr/local/lib/node_modules"),
|
||||
anonymous_student_id = 'student',
|
||||
xblock_model_data = lambda x: x,
|
||||
xblock_model_data = lambda descriptor: descriptor._model_data,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@ class XModuleDescriptor(HTMLSnippet, ResourceTemplates, XBlock):
|
||||
system,
|
||||
self.location,
|
||||
self,
|
||||
system.xblock_model_data(self._model_data),
|
||||
system.xblock_model_data(self),
|
||||
)
|
||||
|
||||
def has_dynamic_children(self):
|
||||
|
||||
@@ -203,9 +203,9 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
|
||||
return get_module(user, request, location,
|
||||
student_module_cache, course_id, position)
|
||||
|
||||
def xblock_model_data(descriptor_model_data):
|
||||
def xblock_model_data(descriptor):
|
||||
return DbModel(
|
||||
LmsKeyValueStore(course_id, user, descriptor_model_data, student_module_cache),
|
||||
LmsKeyValueStore(course_id, user, descriptor._model_data, student_module_cache),
|
||||
descriptor.module_class,
|
||||
user.id,
|
||||
LmsUsage(location, location)
|
||||
|
||||
Reference in New Issue
Block a user