From 606fbb56d9aa757bb3c182006bbf2e70f736b3e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 16 May 2017 00:20:53 +0200 Subject: [PATCH] Support form posted without stripeEmail issue6481 review42291002 --- routes.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/routes.py b/routes.py index 76a2474cee..337fcf6cd6 100644 --- a/routes.py +++ b/routes.py @@ -40,13 +40,14 @@ def checkout(request, pool, model, id): elif request.method == 'POST': record.stripe_token = request.form['stripeToken'] record.save() - email = request.form['stripeEmail'] - for mechanism in record.party.contact_mechanisms: - if mechanism.type == 'email' and mechanism.value == email: - break - else: - mechanism = ContactMechanism( - type='email', value=email, party=record.party) - mechanism.save() + email = request.form.get('stripeEmail') + if email: + for mechanism in record.party.contact_mechanisms: + if mechanism.type == 'email' and mechanism.value == email: + break + else: + mechanism = ContactMechanism( + type='email', value=email, party=record.party) + mechanism.save() return Response( '', 200, content_type='text/html')