From 28d12628f7b0ac235f85871575a7d2a9fec251ca Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Mon, 14 May 2012 15:42:39 -0400 Subject: [PATCH] Fix missing `global_context` problem This problem was introduced in 232e758c7a44f6b048df553abf5bfac1a6b285ef and caused the check answer button to not functioning. --- djangoapps/courseware/capa/responsetypes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/djangoapps/courseware/capa/responsetypes.py b/djangoapps/courseware/capa/responsetypes.py index 3922dd4661..7fb682faf6 100644 --- a/djangoapps/courseware/capa/responsetypes.py +++ b/djangoapps/courseware/capa/responsetypes.py @@ -32,7 +32,6 @@ from lxml.html.soupparser import fromstring as fromstring_bs # uses Beautiful So import calc import eia - def compare_with_tolerance(v1, v2, tol): ''' Compare v1 to v2 with maximum tolerance tol tol is relative if it ends in %; otherwise, it is absolute @@ -238,6 +237,7 @@ def sympy_check2(): student_answers is a dict with everything from request.POST, but with the first part of each key removed (the string before the first "_"). ''' + from capa_problem import global_context submission = [student_answers[k] for k in sorted(self.answer_ids)] self.context.update({'submission':submission}) exec self.code in global_context, self.context @@ -411,6 +411,7 @@ class SchematicResponse(GenericResponse): self.code = answer.text def grade(self, student_answers): + from capa_problem import global_context submission = [json.loads(student_answers[k]) for k in sorted(self.answer_ids)] self.context.update({'submission':submission}) exec self.code in global_context, self.context