Fix error sending notification to no email.
--- 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))