Commit 31641252 by kimth

Typos in and some additional comments

parent 43cd2c21
...@@ -789,6 +789,8 @@ class CodeResponse(LoncapaResponse): ...@@ -789,6 +789,8 @@ class CodeResponse(LoncapaResponse):
In contrast to ExternalResponse, CodeResponse has following behavior: In contrast to ExternalResponse, CodeResponse has following behavior:
1) Goes through a queueing system 1) Goes through a queueing system
2) Does not do external request for 'get_answers' 2) Does not do external request for 'get_answers'
The XML definition of a CodeResponse is meant to be identical to that of ExternalResponse. Simply replace the
tag 'externalresponse' with 'coderesponse'
''' '''
response_tag = 'coderesponse' response_tag = 'coderesponse'
...@@ -797,7 +799,7 @@ class CodeResponse(LoncapaResponse): ...@@ -797,7 +799,7 @@ class CodeResponse(LoncapaResponse):
def setup_response(self): def setup_response(self):
xml = self.xml xml = self.xml
self.url = xml.get('url', "http://ec2-50-16-59-149.compute-1.amazonaws.com/xqueue/submit/") # FIXME -- hardcoded url self.url = xml.get('url', "http://ec2-50-17-86-200.compute-1.amazonaws.com/xqueue/submit/") # FIXME -- hardcoded url
answer = xml.find('answer') answer = xml.find('answer')
if answer is not None: if answer is not None:
...@@ -859,7 +861,6 @@ class CodeResponse(LoncapaResponse): ...@@ -859,7 +861,6 @@ class CodeResponse(LoncapaResponse):
msg = 'Error in CodeResponse %s: cannot parse response from xworker r.text=%s' % (err, score_msg) msg = 'Error in CodeResponse %s: cannot parse response from xworker r.text=%s' % (err, score_msg)
raise Exception(err) raise Exception(err)
# The following process is lifted directly from ExternalResponse
ad = rxml.find('awarddetail').text ad = rxml.find('awarddetail').text
admap = {'EXACT_ANS': 'correct', # TODO: handle other loncapa responses admap = {'EXACT_ANS': 'correct', # TODO: handle other loncapa responses
'WRONG_FORMAT': 'incorrect', 'WRONG_FORMAT': 'incorrect',
...@@ -1020,7 +1021,7 @@ main() ...@@ -1020,7 +1021,7 @@ main()
raise Exception('Error: no response from external server url=%s' % self.url) raise Exception('Error: no response from external server url=%s' % self.url)
try: try:
rxml = etree.fromstring(r.text) # response is XML; prase it rxml = etree.fromstring(r.text) # response is XML; parse it
except Exception as err: except Exception as err:
msg = 'Error %s - cannot parse response from external server r.text=%s' % (err,r.text) msg = 'Error %s - cannot parse response from external server r.text=%s' % (err,r.text)
log.error(msg) log.error(msg)
......
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