Commit 42cef5b7 by Calen Pennington

Get rid of references to self.filename in capa_module, as it no longer exists

parent 68c155b2
...@@ -141,7 +141,7 @@ class CapaModule(XModule): ...@@ -141,7 +141,7 @@ class CapaModule(XModule):
msg = '<p>%s</p>' % msg.replace('<', '&lt;') msg = '<p>%s</p>' % msg.replace('<', '&lt;')
msg += '<p><pre>%s</pre></p>' % traceback.format_exc().replace('<', '&lt;') msg += '<p><pre>%s</pre></p>' % traceback.format_exc().replace('<', '&lt;')
# create a dummy problem with error message instead of failing # create a dummy problem with error message instead of failing
problem_text = '<problem><text><font color="red" size="+2">Problem file %s has an error:</font>%s</text></problem>' % (self.filename, msg) problem_text = '<problem><text><font color="red" size="+2">Problem %s has an error:</font>%s</text></problem>' % (self.location.url(), msg)
self.lcp = LoncapaProblem(problem_text, self.location.html_id(), instance_state, seed=seed, system=self.system) self.lcp = LoncapaProblem(problem_text, self.location.html_id(), instance_state, seed=seed, system=self.system)
else: else:
raise raise
...@@ -368,7 +368,7 @@ class CapaModule(XModule): ...@@ -368,7 +368,7 @@ class CapaModule(XModule):
''' '''
event_info = dict() event_info = dict()
event_info['state'] = self.lcp.get_state() event_info['state'] = self.lcp.get_state()
event_info['filename'] = self.filename event_info['problem_id'] = self.location.url()
answers = self.make_dict_of_responses(get) answers = self.make_dict_of_responses(get)
...@@ -394,13 +394,13 @@ class CapaModule(XModule): ...@@ -394,13 +394,13 @@ class CapaModule(XModule):
correct_map = self.lcp.grade_answers(answers) correct_map = self.lcp.grade_answers(answers)
except StudentInputError as inst: except StudentInputError as inst:
# TODO (vshnayder): why is this line here? # TODO (vshnayder): why is this line here?
self.lcp = LoncapaProblem(self.system.filestore.open(self.filename).read(), self.lcp = LoncapaProblem(self.definition['data'],
id=lcp_id, state=old_state, system=self.system) id=lcp_id, state=old_state, system=self.system)
traceback.print_exc() traceback.print_exc()
return {'success': inst.message} return {'success': inst.message}
except: except:
# TODO: why is this line here? # TODO: why is this line here?
self.lcp = LoncapaProblem(self.system.filestore.open(self.filename).read(), self.lcp = LoncapaProblem(self.definition['data'],
id=lcp_id, state=old_state, system=self.system) id=lcp_id, state=old_state, system=self.system)
traceback.print_exc() traceback.print_exc()
raise Exception("error in capa_module") raise Exception("error in capa_module")
...@@ -434,7 +434,7 @@ class CapaModule(XModule): ...@@ -434,7 +434,7 @@ class CapaModule(XModule):
''' '''
event_info = dict() event_info = dict()
event_info['state'] = self.lcp.get_state() event_info['state'] = self.lcp.get_state()
event_info['filename'] = self.filename event_info['problem_id'] = self.location.url()
answers = self.make_dict_of_responses(get) answers = self.make_dict_of_responses(get)
event_info['answers'] = answers event_info['answers'] = answers
...@@ -468,7 +468,7 @@ class CapaModule(XModule): ...@@ -468,7 +468,7 @@ class CapaModule(XModule):
''' '''
event_info = dict() event_info = dict()
event_info['old_state'] = self.lcp.get_state() event_info['old_state'] = self.lcp.get_state()
event_info['filename'] = self.filename event_info['problem_id'] = self.location.url()
if self.closed(): if self.closed():
event_info['failure'] = 'closed' event_info['failure'] = 'closed'
...@@ -485,7 +485,7 @@ class CapaModule(XModule): ...@@ -485,7 +485,7 @@ class CapaModule(XModule):
# reset random number generator seed (note the self.lcp.get_state() in next line) # reset random number generator seed (note the self.lcp.get_state() in next line)
self.lcp.seed = None self.lcp.seed = None
self.lcp = LoncapaProblem(self.system.filestore.open(self.filename).read(), self.lcp = LoncapaProblem(self.definition['data'],
self.location.html_id(), self.lcp.get_state(), system=self.system) self.location.html_id(), self.lcp.get_state(), system=self.system)
event_info['new_state'] = self.lcp.get_state() event_info['new_state'] = self.lcp.get_state()
......
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