Commit 7f4ebcb6 by ichuang

pep8 fixes - inputtypes

parent fedf216b
...@@ -121,7 +121,7 @@ def optioninput(element, value, status, render_template, msg=''): ...@@ -121,7 +121,7 @@ def optioninput(element, value, status, render_template, msg=''):
eid=element.get('id') eid=element.get('id')
options = element.get('options') options = element.get('options')
if not options: if not options:
raise Exception,"[courseware.capa.inputtypes.optioninput] Missing options specification in " + etree.tostring(element) raise Exception("[courseware.capa.inputtypes.optioninput] Missing options specification in " + etree.tostring(element))
oset = shlex.shlex(options[1:-1]) oset = shlex.shlex(options[1:-1])
oset.quotes = "'" oset.quotes = "'"
oset.whitespace = "," oset.whitespace = ","
...@@ -159,7 +159,7 @@ def choicegroup(element, value, status, render_template, msg=''): ...@@ -159,7 +159,7 @@ def choicegroup(element, value, status, render_template, msg=''):
choices={} choices={}
for choice in element: for choice in element:
if not choice.tag=='choice': if not choice.tag=='choice':
raise Exception,"[courseware.capa.inputtypes.choicegroup] Error only <choice> tags should be immediate children of a <choicegroup>, found %s instead" % choice.tag raise Exception("[courseware.capa.inputtypes.choicegroup] Error only <choice> tags should be immediate children of a <choicegroup>, found %s instead" % choice.tag)
ctext = "" ctext = ""
ctext += ''.join([etree.tostring(x) for x in choice]) # TODO: what if choice[0] has math tags in it? ctext += ''.join([etree.tostring(x) for x in choice]) # TODO: what if choice[0] has math tags in it?
ctext += choice.text # TODO: fix order? ctext += choice.text # TODO: fix order?
...@@ -195,7 +195,6 @@ def textline_dynamath(element, value, status, render_template, msg=''): ...@@ -195,7 +195,6 @@ def textline_dynamath(element, value, status, render_template, msg=''):
''' '''
# TODO: Make a wrapper for <formulainput> # TODO: Make a wrapper for <formulainput>
# TODO: Make an AJAX loop to confirm equation is okay in real-time as user types # TODO: Make an AJAX loop to confirm equation is okay in real-time as user types
## TODO: Code should follow PEP8 (4 spaces per indentation level)
''' '''
textline is used for simple one-line inputs, like formularesponse and symbolicresponse. textline is used for simple one-line inputs, like formularesponse and symbolicresponse.
uses a <span id=display_eid>`{::}`</span> uses a <span id=display_eid>`{::}`</span>
...@@ -346,14 +345,14 @@ def imageinput(element, value, status, render_template, msg=''): ...@@ -346,14 +345,14 @@ def imageinput(element, value, status, render_template, msg=''):
(gx,gy) = (0,0) (gx,gy) = (0,0)
context = { context = {
'id':eid, 'id': eid,
'value':value, 'value': value,
'height': height, 'height': height,
'width' : width, 'width': width,
'src':src, 'src': src,
'gx':gx, 'gx': gx,
'gy':gy, 'gy': gy,
'state' : status, # to change 'state': status, # to change
'msg': msg, # to change 'msg': msg, # to change
} }
html = render_template("imageinput.html", context) html = render_template("imageinput.html", context)
......
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