Commit 879fb0db by ichuang

Merge pull request #445 from MITx/kimth/sjsu

Fix CustomResponse for 6.002x
changes affect 6.002 model of customresponse, making it slightly more robust when improperly used.
parents bea9aec6 0a9065f2
......@@ -873,6 +873,7 @@ def sympy_check2():
msg = '<font color="red">No answer entered!</font>' 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
......
......@@ -38,5 +38,7 @@
% if msg:
<span class="message">${msg|n}</span>
% endif
% if state in ['unsubmitted', 'correct', 'incorrect', 'incomplete'] or hidden:
</div>
% endif
</section>
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