mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
commit
1dbfc554c8
1 changed files with 28 additions and 20 deletions
|
@ -3,6 +3,7 @@ from collections import defaultdict
|
||||||
from flask import *
|
from flask import *
|
||||||
from flaskext.mail import Mail, Message
|
from flaskext.mail import Mail, Message
|
||||||
from flaskext.babel import get_locale, gettext as _
|
from flaskext.babel import get_locale, gettext as _
|
||||||
|
from smtplib import SMTPRecipientsRefused
|
||||||
import werkzeug
|
import werkzeug
|
||||||
|
|
||||||
# local modules
|
# local modules
|
||||||
|
@ -142,10 +143,17 @@ def create_project():
|
||||||
msg = Message(message_title,
|
msg = Message(message_title,
|
||||||
body=message_body,
|
body=message_body,
|
||||||
recipients=[project.contact_email])
|
recipients=[project.contact_email])
|
||||||
mail.send(msg)
|
try:
|
||||||
|
mail.send(msg)
|
||||||
|
except SMTPRecipientsRefused:
|
||||||
|
msg_compl = 'Problem sending mail. '
|
||||||
|
# TODO: destroy the project and cancel instead?
|
||||||
|
else:
|
||||||
|
msg_compl = ''
|
||||||
|
|
||||||
# redirect the user to the next step (invite)
|
# redirect the user to the next step (invite)
|
||||||
flash(_("The project identifier is %(project)s", project=project.id))
|
flash(_("%(msg_compl)sThe project identifier is %(project)s",
|
||||||
|
msg_compl=msg_compl, project=project.id))
|
||||||
return redirect(url_for(".invite", project_id=project.id))
|
return redirect(url_for(".invite", project_id=project.id))
|
||||||
|
|
||||||
return render_template("create_project.html", form=form)
|
return render_template("create_project.html", form=form)
|
||||||
|
|
Loading…
Reference in a new issue