From 1d5f32d065b959622d1bc5bb4066791810156433 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 29 May 2013 14:24:43 -0400 Subject: [PATCH] Give all response types an id attribute. CustomResponse had one, with a silly name. Use it for all ResponseTypes. --- common/lib/capa/capa/responsetypes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index a166438f17..79b049eba6 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -140,6 +140,8 @@ class LoncapaResponse(object): self.context = context self.system = system + self.id = xml.get('id') + for abox in inputfields: if abox.tag not in self.allowed_inputfields: msg = "%s: cannot have input field %s" % ( @@ -935,7 +937,6 @@ class CustomResponse(LoncapaResponse): # if has an "expect" (or "answer") attribute then save # that self.expect = xml.get('expect') or xml.get('answer') - self.myid = xml.get('id') log.debug('answer_ids=%s' % self.answer_ids) @@ -981,7 +982,7 @@ class CustomResponse(LoncapaResponse): if not self.code: if answer is None: log.error("[courseware.capa.responsetypes.customresponse] missing" - " code checking script! id=%s" % self.myid) + " code checking script! id=%s" % self.id) self.code = '' else: answer_src = answer.get('src') @@ -1034,7 +1035,7 @@ class CustomResponse(LoncapaResponse): # note that this doesn't help the "cfn" version - only the exec version self.context.update({ # my ID - 'response_id': self.myid, + 'response_id': self.id, # expected answer (if given as attribute) 'expect': self.expect,