Commit efaa0eea by Ned Batchelder

More fixes to the merge, now all tests pass.

parent be79810f
......@@ -1086,7 +1086,15 @@ class CustomResponse(LoncapaResponse):
# to the same correct/incorrect value
if 'ok' in ret:
correct = ['correct' if ret['ok'] else 'incorrect'] * len(idset)
self.context['messages'][0] = self.clean_message_html(ret['msg'])
msg = ret.get('msg', None)
msg = self.clean_message_html(msg)
# If there is only one input, apply the message to that input
# Otherwise, apply the message to the whole problem
if len(idset) > 1:
self.context['overall_message'] = msg
else:
self.context['messages'][0] = msg
# Another kind of dictionary the check function can return has
# the form:
......
......@@ -977,7 +977,7 @@ class CustomResponseTest(ResponseTest):
msg = correct_map.get_msg('1_2_1')
self.assertEqual(correctness, 'correct')
self.assertEqual(msg, "Message text\n")
self.assertEqual(msg, "Message text")
# Incorrect answer
input_dict = {'1_2_1': '0'}
......@@ -987,7 +987,7 @@ class CustomResponseTest(ResponseTest):
msg = correct_map.get_msg('1_2_1')
self.assertEqual(correctness, 'incorrect')
self.assertEqual(msg, "Message text\n")
self.assertEqual(msg, "Message text")
def test_multiple_inputs_return_one_status(self):
# When given multiple inputs, the 'answer_given' argument
......
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