Add support for choices in arguments to web interface

This commit is contained in:
Florian Festi 2016-06-27 09:09:28 +02:00
parent a1ab401be4
commit ab1809c42b
1 changed files with 6 additions and 0 deletions

View File

@ -108,6 +108,12 @@ class BServer:
elif a.type is bool:
input = """<input name="%s" type="checkbox">""" % \
(name, )
elif a.choices:
options = "\n".join(
("""<option value="%s"%s>%s</option>""" %
(e, ' selected="selected"' if e == a.default else "",
e) for e in a.choices))
input = """<select name="%s" size="1">\n%s</select>\n""" % (name, options)
else:
input = """<input name="%s" type="text" value="%s">""" % \
(name, a.default)