Commit 8e213f53 by Vik Paruchuri

Fix rubric parsing errors

parent f5600c2b
......@@ -22,6 +22,7 @@ from xmodule.modulestore import Location
import self_assessment_module
import open_ended_module
from combined_open_ended_rubric import CombinedOpenEndedRubric
from .stringify import stringify_children
from mitxmako.shortcuts import render_to_string
......@@ -142,11 +143,11 @@ class CombinedOpenEndedModule(XModule):
self._max_score = int(self.metadata.get('max_score', MAX_SCORE))
rubric_renderer = CombinedOpenEndedRubric(True)
success, rubric_feedback = rubric_renderer.render_rubric(True, definition['rubric'])
success, rubric_feedback = rubric_renderer.render_rubric(stringify_children(definition['rubric']))
if not success:
error_message="Could not parse rubric : {0}".format(definition['rubric'])
log.exception(error_message)
raise Exception(error_message)
raise Exception
#Static data is passed to the child modules to render
self.static_data = {
'max_score': self._max_score,
......
......@@ -22,7 +22,6 @@ class CombinedOpenEndedRubric:
def render_rubric(self, rubric_xml):
success = False
try:
rubric_xml = rubric_xml.encode('ascii', 'ignore')
rubric_categories = self.extract_categories(rubric_xml)
html = render_to_string('open_ended_rubric.html',
{'categories' : rubric_categories,
......@@ -53,7 +52,8 @@ class CombinedOpenEndedRubric:
{text: "Option 3 Name", points: 2]}]
'''
element = etree.fromstring(element)
if isinstance(element, basestring):
element = etree.fromstring(element)
categories = []
for category in element:
if category.tag != 'category':
......
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