From 0a9065f2bea773df5013c455a4405b941fe8a234 Mon Sep 17 00:00:00 2001 From: kimth Date: Thu, 16 Aug 2012 22:00:10 -0400 Subject: [PATCH] Fix CustomResponse for 6.002x --- common/lib/capa/capa/responsetypes.py | 2 ++ common/lib/capa/capa/templates/textinput.html | 2 ++ 2 files changed, 4 insertions(+) diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index d327b80c14..fcb36a1d03 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -873,6 +873,7 @@ def sympy_check2(): msg = 'No answer entered!' if self.xml.get('empty_answer_err') else '' return CorrectMap(idset[0], 'incorrect', msg=msg) + # NOTE: correct = 'unknown' could be dangerous. Inputtypes such as textline are not expecting 'unknown's correct = ['unknown'] * len(idset) messages = [''] * len(idset) @@ -898,6 +899,7 @@ def sympy_check2(): if type(self.code) == str: try: exec self.code in self.context['global_context'], self.context + correct = self.context['correct'] except Exception as err: print "oops in customresponse (code) error %s" % err print "context = ", self.context diff --git a/common/lib/capa/capa/templates/textinput.html b/common/lib/capa/capa/templates/textinput.html index 7f2f563b81..08aa8379a7 100644 --- a/common/lib/capa/capa/templates/textinput.html +++ b/common/lib/capa/capa/templates/textinput.html @@ -38,5 +38,7 @@ % if msg: ${msg|n} % endif +% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete'] or hidden: +% endif