Commit 4f5904c3 by Braden MacDonald

Deal with invalid <tip> elements when the desired meaning can be inferred

parent b3cb55c8
...@@ -282,7 +282,7 @@ class TipChanges(Change): ...@@ -282,7 +282,7 @@ class TipChanges(Change):
elif self.node.attrib.get("reject"): elif self.node.attrib.get("reject"):
value = self.node.attrib.pop("reject") value = self.node.attrib.pop("reject")
else: else:
warnings.warn("Invalid <tip> element found.") warnings.warn(u"Invalid <tip> element found: {}".format(etree.tostring(self.node)))
return return
else: else:
# This is an MCQ or Rating question: # This is an MCQ or Rating question:
...@@ -291,8 +291,12 @@ class TipChanges(Change): ...@@ -291,8 +291,12 @@ class TipChanges(Change):
add_to_list("correct_choices", value) add_to_list("correct_choices", value)
elif self.node.attrib.get("reject"): elif self.node.attrib.get("reject"):
value = self.node.attrib.pop("reject") value = self.node.attrib.pop("reject")
elif self.node.attrib.get("require"):
value = self.node.attrib.pop("require")
add_to_list("correct_choices", value)
warnings.warn(u"<tip> element in an MCQ/Rating used 'require' rather than 'display'")
else: else:
warnings.warn("Invalid <tip> element found.") warnings.warn(u"Invalid <tip> element found: {}".format(etree.tostring(self.node)))
return return
self.node.attrib["values"] = value self.node.attrib["values"] = value
if (self.node.text is None or self.node.text.strip() == "") and not list(self.node): if (self.node.text is None or self.node.text.strip() == "") and not list(self.node):
......
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