'Init is passed the following arguments:
- xml         : ElementTree of this Response
- inputfields : ordered list of ElementTrees for each input entry field in this Response
- context     : script processor context
- system      : LoncapaSystem instance which provides OS, rendering, and user context
- capa_module : Capa module, to access runtime'

def __init__(self, xml, inputfields, context, system, capa_module, minimal_init):

    self.xml = xml
    self.inputfields = inputfields
    self.context = context
    self.capa_system = system
    self.capa_module = capa_module
    self.id = xml.get('id')
    for abox in inputfields:
        if (abox.tag not in self.allowed_inputfields):
            msg = ('%s:    cannot    have    input    field    %s' % (unicode(self), abox.tag))
            msg += ('\nSee    XML    source    line    %s' % getattr(xml, 'sourceline', '<unavailable>'))
            raise LoncapaProblemError(msg)
    if (self.max_inputfields and (len(inputfields) > self.max_inputfields)):
        msg = ('%s:    cannot    have    more    than    %s    input    fields' % (unicode(self), self.max_inputfields))
        msg += ('\nSee    XML    source    line    %s' % getattr(xml, 'sourceline', '<unavailable>'))
        raise LoncapaProblemError(msg)
    for prop in self.required_attributes:
        if (not xml.get(prop)):
            msg = ('Error    in    problem    specification:    %s    missing    required    attribute    %s' % (unicode(self), prop))
            msg += ('\nSee    XML    source    line    %s' % getattr(xml, 'sourceline', '<unavailable>'))
            raise LoncapaProblemError(msg)
    self.answer_ids = [x.get('id') for x in self.inputfields]
    if (self.max_inputfields == 1):
        self.answer_id = self.answer_ids[0]
    self.maxpoints = dict()
    for inputfield in self.inputfields:
        maxpoints = inputfield.get('points', '1')
        self.maxpoints.update({inputfield.get('id'): int(maxpoints)})
    if (not minimal_init):
        self.default_answer_map = {}
        for entry in self.inputfields:
            answer = entry.get('correct_answer')
            if answer:
                self.default_answer_map[entry.get('id')] = contextualize_text(answer, self.context)
        partial_credit = xml.xpath('.')[0].get('partial_credit', default=False)
        if (str(partial_credit).lower().strip() == 'false'):
            self.has_partial_credit = False
            self.credit_type = []
        else:
            self.has_partial_credit = True
            self.credit_type = partial_credit.split(',')
            self.credit_type = [word.strip().lower() for word in self.credit_type]
        if hasattr(self, 'setup_response'):
            self.setup_response()
