summaryrefslogtreecommitdiff
path: root/webapp.py
diff options
context:
space:
mode:
Diffstat (limited to 'webapp.py')
-rw-r--r--webapp.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/webapp.py b/webapp.py
index 03d37b3..8cdd43a 100644
--- a/webapp.py
+++ b/webapp.py
@@ -278,8 +278,8 @@ schedule_template = """<!DOCTYPE html>
<html>
<body>
<p>Scheduled a build of {{ request.form["source"]|e }}
- {%- if request.form["archpair"] != "any_any" %}
- for {{ request.form["archpair"]|archpair_format -}}
+ {%- if buildarch or hostarch %}
+ for {{ (buildarch|default("any"), hostarch|default("any"))|archpair_format -}}
{%- endif %}.
<p>
</body>
@@ -422,7 +422,10 @@ def show_log(filename):
@app.route("/schedule", methods=["POST"])
def request_schedule():
source = flask.request.form["source"]
- buildarch, hostarch = flask.request.form["archpair"].split("_")
+ try:
+ buildarch, hostarch = flask.request.form["archpair"].split("_")
+ except ValueError:
+ raise werkzeug.exceptions.BadRequest()
if buildarch == "any":
buildarch = None
elif buildarch != "amd64":
@@ -445,4 +448,5 @@ def request_schedule():
VALUES (:source, :buildarch, :hostarch, datetime('now'));""")
conn.execute(query, source=source, buildarch=buildarch,
hostarch=hostarch)
- return flask.render_template_string(schedule_template)
+ return flask.render_template_string(schedule_template, buildarch=buildarch,
+ hostarch=hostarch)