Fix error when getting page for invalid code
This commit is contained in:
parent
9f66c76a9e
commit
f980973f6e
|
@ -37,6 +37,14 @@ def thanks():
|
||||||
|
|
||||||
@app.route('/france/<code>', methods=['GET', 'POST'])
|
@app.route('/france/<code>', methods=['GET', 'POST'])
|
||||||
def rsvp(code):
|
def rsvp(code):
|
||||||
|
# Lookup guests from code
|
||||||
|
adults = None
|
||||||
|
children = None
|
||||||
|
try:
|
||||||
|
name, adults, children = get_name_and_replies(code)
|
||||||
|
except ValueError:
|
||||||
|
return render_template('form.html', error="Code invalide")
|
||||||
|
|
||||||
error = None
|
error = None
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
try:
|
try:
|
||||||
|
@ -49,14 +57,6 @@ def rsvp(code):
|
||||||
record_reply(code, adults, children)
|
record_reply(code, adults, children)
|
||||||
return redirect(url_for('thanks'))
|
return redirect(url_for('thanks'))
|
||||||
|
|
||||||
# Lookup guests from code
|
|
||||||
adults = None
|
|
||||||
children = None
|
|
||||||
try:
|
|
||||||
name, adults, children = get_name_and_replies(code)
|
|
||||||
except ValueError:
|
|
||||||
error = "Code invalide"
|
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'rsvp.html',
|
'rsvp.html',
|
||||||
adults=adults,
|
adults=adults,
|
||||||
|
|
Loading…
Reference in New Issue