get a serializable version of web forms data

workspace
Brendan Howell 4 years ago
parent 45d2dc7949
commit 54be0537d5

@ -92,23 +92,24 @@ class Audio(Bureau):
Edit internet radio stations. Edit internet radio stations.
""" """
#TODO: allow deletes #TODO: allow deletes
#TODO: show existing stations
#TODO: print out any new station #TODO: print out any new station
#TODO: use some kind of nicer templates? #TODO: use some kind of nicer templates?
ret = """ ret = """
<html><head><title>screenless office - internet radio admin</title></head> <html><head><title>screenless office - internet radio admin</title></head>
<body> <body>
<h1>Audio Department</h1> <h1>Audio Department</h1>
<h2>Radio Stations<h2>
<ul>
""" """
with self.urldb.env.begin(db=self.urldb.db) as txn:
for sh_code, url in txn.cursor():
ret += "<li>" + url + "</li>\n"
if data: if data:
if data["addurl"]: if data["addurl"]:
self.save_url(data["addurl"]) self.save_url(data["addurl"])
ret += "<div>New station " + data["addurl"] + " saved!</div>\n" ret += "<div>New station " + data["addurl"] + " saved!</div>\n"
ret += "<h2>Radio Stations<h2>\n <ul>\n"
with self.urldb.env.begin(db=self.urldb.db) as txn:
for sh_code, url in txn.cursor():
ret += "<li>" + url.decode("utf-8") + "</li>\n"
ret += "</ul>\n"
ret += """ ret += """
<form action='/AU/radio' method='POST'> <form action='/AU/radio' method='POST'>
<ul> <ul>

Loading…
Cancel
Save