Skip to content
Snippets Groups Projects
Commit 5540964a authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Remove redundant error checks and add empty contents check

parent 837c01c6
Branches
Tags
1 merge request!69Feature/comp 257 send email on signup
...@@ -29,14 +29,8 @@ def send_mail( ...@@ -29,14 +29,8 @@ def send_mail(
logger.warning('No mail configuration, cannot send email.') logger.warning('No mail configuration, cannot send email.')
return return
if not isinstance(contents, str): if not contents or not isinstance(contents, str):
raise ValueError('Contents must be a string.') raise ValueError('Contents must be a non-empty string.')
if not isinstance(subject, str):
raise ValueError('Subject must be a string.')
if not isinstance(recipients, (str, Sequence)):
raise ValueError('Recipients must be a string or a sequence of strings.')
excluded_admins = set(email.lower() for email in current_app.config['MAIL_EXCLUDED_ADMINS']) excluded_admins = set(email.lower() for email in current_app.config['MAIL_EXCLUDED_ADMINS'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment