From 6595d53212eaa4b9319da7196f5e2286d30eb462 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 6 Jun 2021 10:11:00 +0000 Subject: Format code with black This commit fixes the style issues introduced in 57207ef according to the output from black. Details: https://deepsource.io/gh/navanchauhan/SaaS-in-a-Flask/transform/fb582430-1f1f-45bb-8c05-5f5bec16f981/ --- app/misc_func.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'app/misc_func.py') diff --git a/app/misc_func.py b/app/misc_func.py index 73e920d..d560337 100644 --- a/app/misc_func.py +++ b/app/misc_func.py @@ -3,25 +3,29 @@ from flask import flash from flask_mailman import EmailMultiAlternatives from app import app, mail + def flash_errors(form): for field, errors in form.errors.items(): for error in errors: - flash(u"Error in the %s field - %s" % ( - getattr(form, field).label.text, - error - ), 'danger') - -# Sauce: https://github.com/alectrocute/flaskSaaS/blob/master/app/toolbox/email.py - -def send(to, subject, body, body_html,thread=True): - sender = app.config["MAIL_FROM"] - message = EmailMultiAlternatives( - subject,body,sender,[to]) - message.attach_alternative(body_html,"text/html") - thr = Thread(target=send_async, args=[app,message]) + flash( + u"Error in the %s field - %s" + % (getattr(form, field).label.text, error), + "danger", + ) + + +# Sauce: https://github.com/alectrocute/flaskSaaS/blob/master/app/toolbox/email.py + + +def send(to, subject, body, body_html, thread=True): + sender = app.config["MAIL_FROM"] + message = EmailMultiAlternatives(subject, body, sender, [to]) + message.attach_alternative(body_html, "text/html") + thr = Thread(target=send_async, args=[app, message]) thr.start() + def send_async(app, message): with app.app_context(): message.send() - print("Mail Sent") \ No newline at end of file + print("Mail Sent") -- cgit v1.2.3