Parse and pass metadata
This commit is contained in:
@@ -138,8 +138,9 @@ class CombinedOpenEndedModule(XModule):
|
||||
version_index = versions.index(self.version)
|
||||
|
||||
self.child_descriptor = descriptors[version_index](self.system)
|
||||
self.child_definition = self.child_descriptor.definition_from_xml(etree.fromstring(definition['xml_string']))
|
||||
self.child_module = modules[version_index](self.system, location, self.child_definition, self.child_descriptor, instance_state)
|
||||
self.child_definition = CombinedOpenEndedV1Descriptor.definition_from_xml(etree.fromstring(definition['xml_string']), self.system)
|
||||
self.child_module = modules[version_index](self.system, location, self.child_definition, self.child_descriptor,
|
||||
instance_state = json.dumps(instance_state), metadata = definition['metadata'])
|
||||
|
||||
def get_html(self):
|
||||
return self.child_module.get_html()
|
||||
@@ -187,7 +188,8 @@ class CombinedOpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
|
||||
'task_xml': dictionary of xml strings,
|
||||
}
|
||||
"""
|
||||
return {'xml_string' : etree.tostring(xml_object)}
|
||||
|
||||
return {'xml_string' : etree.tostring(xml_object), 'metadata' : xml_object.attrib}
|
||||
|
||||
|
||||
def definition_to_xml(self, resource_fs):
|
||||
|
||||
@@ -98,7 +98,7 @@ class CombinedOpenEndedV1Module():
|
||||
css = {'scss': [resource_string(__name__, 'css/combinedopenended/display.scss')]}
|
||||
|
||||
def __init__(self, system, location, definition, descriptor,
|
||||
instance_state=None, shared_state=None, **kwargs):
|
||||
instance_state=None, shared_state=None, metadata = None, **kwargs):
|
||||
|
||||
"""
|
||||
Definition file should have one or many task blocks, a rubric block, and a prompt block:
|
||||
@@ -135,6 +135,8 @@ class CombinedOpenEndedV1Module():
|
||||
|
||||
"""
|
||||
|
||||
self.metadata = metadata
|
||||
|
||||
# Load instance state
|
||||
if instance_state is not None:
|
||||
instance_state = json.loads(instance_state)
|
||||
|
||||
Reference in New Issue
Block a user