Commit 26541bb7 by Lyla Fischer

fixed naming convention on response types

parent 05d96b79
......@@ -15,18 +15,18 @@ from mako.template import Template
from util import contextualize_text
import inputtypes
from responsetypes import numericalresponse, formularesponse, customresponse, schematicresponse, multiplechoiceresponse, StudentInputError
from responsetypes import NumericalResponse, FormulaResponse, CustomResponse, SchematicResponse, MultipleChoiceResponse, StudentInputError
import calc
import eia
log = logging.getLogger("mitx.courseware")
response_types = {'numericalresponse':numericalresponse,
'formularesponse':formularesponse,
'customresponse':customresponse,
'schematicresponse':schematicresponse,
'multiplechoiceresponse':multiplechoiceresponse}
response_types = {'numericalresponse':NumericalResponse,
'formularesponse':FormulaResponse,
'customresponse':CustomResponse,
'schematicresponse':SchematicResponse,
'multiplechoiceresponse':MultipleChoiceResponse}
entry_types = ['textline', 'schematic', 'choicegroup']
response_properties = ["responseparam", "answer"]
# How to convert from original XML to HTML
......
......@@ -38,7 +38,7 @@ def compare_with_tolerance(v1, v2, tol):
#Every response type needs methods "grade" and "get_answers"
class multiplechoiceresponse(object):
class MultipleChoiceResponse(object):
def __init__(self, xml, context):
self.xml = xml
self.correct_choices = xml.xpath('//*[@id=$id]//choice[@correct="true"]',
......@@ -62,7 +62,7 @@ class multiplechoiceresponse(object):
def get_answers(self):
return {self.answer_id:self.correct_choices}
class numericalresponse(object):
class NumericalResponse(object):
def __init__(self, xml, context):
self.xml = xml
self.correct_answer = contextualize_text(xml.get('answer'), context)
......@@ -91,7 +91,7 @@ class numericalresponse(object):
def get_answers(self):
return {self.answer_id:self.correct_answer}
class customresponse(object):
class CustomResponse(object):
def __init__(self, xml, context):
self.xml = xml
## CRITICAL TODO: Should cover all entrytypes
......@@ -122,7 +122,7 @@ class customresponse(object):
class StudentInputError(Exception):
pass
class formularesponse(object):
class FormulaResponse(object):
def __init__(self, xml, context):
self.xml = xml
self.correct_answer = contextualize_text(xml.get('answer'), context)
......@@ -192,7 +192,7 @@ class formularesponse(object):
def get_answers(self):
return {self.answer_id:self.correct_answer}
class schematicresponse(object):
class SchematicResponse(object):
def __init__(self, xml, context):
self.xml = xml
self.answer_ids = xml.xpath('//*[@id=$id]//schematic/@id',
......
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