Put description into web page
This commit is contained in:
parent
5dabd9991d
commit
7bdc3e8737
10
bserver.py
10
bserver.py
|
@ -52,20 +52,22 @@ class BServer:
|
||||||
return """<tr><td>%s</td><td><input name="%s" type="text" value="%s"></td><td>%s</td></tr>\n""" % \
|
return """<tr><td>%s</td><td><input name="%s" type="text" value="%s"></td><td>%s</td></tr>\n""" % \
|
||||||
(name, name, a.default, a.help)
|
(name, name, a.default, a.help)
|
||||||
|
|
||||||
def args2html(self, name, args):
|
def args2html(self, name, box):
|
||||||
result = ["""<html><head><title>Boxes - """, name, """</title></head>
|
result = ["""<html><head><title>Boxes - """, name, """</title></head>
|
||||||
<body>
|
<body>
|
||||||
|
<h1>""", name, """</h1>
|
||||||
|
<p>""", box.__doc__, """</p>
|
||||||
<form action="" method="POST" target="_blank">
|
<form action="" method="POST" target="_blank">
|
||||||
<table>
|
<table>
|
||||||
"""]
|
"""]
|
||||||
for a in args._actions:
|
for a in box.argparser._actions:
|
||||||
if a.dest == "output":
|
if a.dest == "output":
|
||||||
continue
|
continue
|
||||||
result.append(self.arg2html(a))
|
result.append(self.arg2html(a))
|
||||||
if a.dest == "burn":
|
if a.dest == "burn":
|
||||||
result.append("</table>\n<hr>\n<table>\n")
|
result.append("</table>\n<hr>\n<table>\n")
|
||||||
result.append("""</table>
|
result.append("""</table>
|
||||||
<button>Generate</button>
|
<p><button>Generate</button></p>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -125,7 +127,7 @@ flex cuts, holes and slots for screws and more high level functions.
|
||||||
|
|
||||||
if environ["REQUEST_METHOD"] == "GET":
|
if environ["REQUEST_METHOD"] == "GET":
|
||||||
start_response(status, headers)
|
start_response(status, headers)
|
||||||
return self.args2html(name, box.argparser)
|
return self.args2html(name, box)
|
||||||
elif environ["REQUEST_METHOD"] == "POST":
|
elif environ["REQUEST_METHOD"] == "POST":
|
||||||
try:
|
try:
|
||||||
length = int(environ.get('CONTENT_LENGTH', '0'))
|
length = int(environ.get('CONTENT_LENGTH', '0'))
|
||||||
|
|
Loading…
Reference in New Issue