From ac631eef99ef98ab7dd9beac4de8ef97f68961fd Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 25 2015 13:37:18 +0000 Subject: Do not try to send notification if there is no-one to send to Since we now remove the person doing the action from the notifications, we can see the situation where it was the only person listed to be notified in which case the to_mail list is empty. In such case, just return --- diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index f83e315..b4e6e3f 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -74,6 +74,9 @@ def send_email(text, subject, to_mail, from_mail=None, mail_id=None, this value ''' + if not to_mail: + return + msg = MIMEText(text.encode('utf-8'), 'plain', 'utf-8') msg['Subject'] = '[Pagure] %s' % subject if not from_mail: