# HG changeset patch # User gibus # Date 1384792313 -3600 # Node ID dc415eb33a3fa63687f174d0e3a003f3b7f7419d # Parent 163cf095f70886f738fc323e75403de22d0b89c8 Fix error sending notification to no email. diff -r 163cf095f708 -r dc415eb33a3f src/cm/notifications.py --- a/src/cm/notifications.py Wed Nov 06 19:07:25 2013 +0100 +++ b/src/cm/notifications.py Mon Nov 18 17:31:53 2013 +0100 @@ -57,8 +57,9 @@ def send_notification(activity, notification): email = notification.user.email if notification.user else notification.email - subject = _('Notification:') + " " + activity.printable_data(html=False, link=False) - message = render_to_string('email/activity_notification.txt', + if email: + subject = _('Notification:') + " " + activity.printable_data(html=False, link=False) + message = render_to_string('email/activity_notification.txt', { 'activity' : activity, 'notification' : notification, @@ -66,6 +67,6 @@ 'CONF' : ApplicationConfiguration, }) - send_mail(subject, message, ApplicationConfiguration['email_from'], [email], fail_silently=True) + send_mail(subject, message, ApplicationConfiguration['email_from'], [email], fail_silently=True) - #logging.debug(u"Notification sent [%s] => %s" %(activity,notification.user) if notification.user else u"sending (email) %s => %s" %(activity,notification.email)) + #logging.debug(u"Notification sent [%s] => %s" %(activity,notification.user) if notification.user else u"sending (email) %s => %s" %(activity,notification.email))