From 323fb18c7461b4574c88926f6488952ee3e89071 Mon Sep 17 00:00:00 2001 From: Arjun Singh Date: Tue, 7 Aug 2012 00:14:48 -0400 Subject: [PATCH] Poor fix for a breaking change in which student answers that were arrays (e.g. those resulting from a checkbox group) would be converted to strings and graded incorrectly. --- common/lib/capa/capa/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/lib/capa/capa/util.py b/common/lib/capa/capa/util.py index 1dc113cd20..211ada4d62 100644 --- a/common/lib/capa/capa/util.py +++ b/common/lib/capa/capa/util.py @@ -39,5 +39,10 @@ def convert_files_to_filenames(answers): ''' new_answers = dict() for answer_id in answers.keys(): - new_answers[answer_id] = unicode(answers[answer_id]) + # TODO This should be done more cleanly; however, this fixes bugs + # that were introduced with this function. + if isinstance(answers[answer_id], list): + new_answers[answer_id] = answers[answer_id] + else: + new_answers[answer_id] = unicode(answers[answer_id]) return new_answers