Commit e32fa060 by Piotr Mitros

Removing FS references; code may be unstable

parent 22189661
......@@ -117,7 +117,7 @@ class LoncapaProblem(object):
self.preprocess_problem(self.tree, correct_map=self.correct_map, answer_map = self.student_answers)
self.context = self.extract_context(self.tree, seed=self.seed)
for response in self.tree.xpath('//'+"|//".join(response_types)):
responder = response_types[response.tag](response, self.context)
responder = response_types[response.tag](response, self.context, self.system)
responder.preprocess_response()
def get_state(self):
......@@ -163,7 +163,7 @@ class LoncapaProblem(object):
self.correct_map = dict()
problems_simple = self.extract_problems(self.tree)
for response in problems_simple:
grader = response_types[response.tag](response, self.context)
grader = response_types[response.tag](response, self.context, self.system)
results = grader.grade(answers) # call the responsetype instance to do the actual grading
self.correct_map.update(results)
return self.correct_map
......@@ -177,7 +177,7 @@ class LoncapaProblem(object):
answer_map = dict()
problems_simple = self.extract_problems(self.tree) # purified (flat) XML tree of just response queries
for response in problems_simple:
responder = response_types[response.tag](response, self.context) # instance of numericalresponse, customresponse,...
responder = response_types[response.tag](response, self.context, self.system) # instance of numericalresponse, customresponse,...
results = responder.get_answers()
answer_map.update(results) # dict of (id,correct_answer)
......
......@@ -68,10 +68,10 @@ class MultipleChoiceResponse(GenericResponse):
<multiplechoiceresponse direction="vertical" randomize="yes">
<choicegroup type="MultipleChoice">
<choice location="random" name="1" correct="false"><span>`a+b`<br/></span></choice>
<choice location="random" name="2" correct="true"><span><math>a+b^2</math><br/></span></choice>
<choice location="random" name="3" correct="false"><math>a+b+c</math></choice>
<choice location="bottom" name="4" correct="false"><math>a+b+d</math></choice>
<choice location="random" correct="false"><span>`a+b`<br/></span></choice>
<choice location="random" correct="true"><span><math>a+b^2</math><br/></span></choice>
<choice location="random" correct="false"><math>a+b+c</math></choice>
<choice location="bottom" correct="false"><math>a+b+d</math></choice>
</choicegroup>
</multiplechoiceresponse>
......@@ -406,7 +406,7 @@ class SchematicResponse(GenericResponse):
id=xml.get('id'))[0]
answer_src = answer.get('src')
if answer_src != None:
self.code = open(settings.DATA_DIR+'src/'+answer_src).read()
self.code = self.system.filestore.open('src/'+answer_src).read() # Untested; never used
else:
self.code = answer.text
......
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