Integrated PR feedback for code clarity

This commit is contained in:
petermaksymo 2021-12-22 18:04:35 -05:00
parent 74280d40c1
commit ee3c62c665

View file

@ -52,21 +52,16 @@ def flash_email_error(error_message, category="danger"):
admin email as a contact if MAIL_DEFAULT_SENDER is set to not the admin email as a contact if MAIL_DEFAULT_SENDER is set to not the
default value and SHOW_ADMIN_EMAIL is True. default value and SHOW_ADMIN_EMAIL is True.
""" """
admin_email = current_app.config.get("MAIL_DEFAULT_SENDER") (admin_name, admin_email) = current_app.config.get("MAIL_DEFAULT_SENDER")
error_extension = "." error_extension = "."
if ( if admin_email != "admin@example.com" and current_app.config.get(
admin_email "SHOW_ADMIN_EMAIL"
and admin_email[1] != "admin@example.com"
and current_app.config.get("SHOW_ADMIN_EMAIL")
): ):
error_extension = " or contact the administrator at {}.".format(admin_email[1]) error_extension = f" or contact the administrator at {admin_email}."
flash( flash(
_( _(
error_message f"{error_message} Please check the email configuration of the server{error_extension}"
+ " Please check the email configuration of the server {}".format(
error_extension
)
), ),
category=category, category=category,
) )