55 |
55 |
56 signals.post_save.connect(notify, sender=Activity) |
56 signals.post_save.connect(notify, sender=Activity) |
57 |
57 |
58 def send_notification(activity, notification): |
58 def send_notification(activity, notification): |
59 email = notification.user.email if notification.user else notification.email |
59 email = notification.user.email if notification.user else notification.email |
60 subject = _('Notification:') + " " + activity.printable_data(html=False, link=False) |
60 if email: |
61 message = render_to_string('email/activity_notification.txt', |
61 subject = _('Notification:') + " " + activity.printable_data(html=False, link=False) |
|
62 message = render_to_string('email/activity_notification.txt', |
62 { |
63 { |
63 'activity' : activity, |
64 'activity' : activity, |
64 'notification' : notification, |
65 'notification' : notification, |
65 'SITE_URL' : settings.SITE_URL, |
66 'SITE_URL' : settings.SITE_URL, |
66 'CONF' : ApplicationConfiguration, |
67 'CONF' : ApplicationConfiguration, |
67 }) |
68 }) |
68 |
69 |
69 send_mail(subject, message, ApplicationConfiguration['email_from'], [email], fail_silently=True) |
70 send_mail(subject, message, ApplicationConfiguration['email_from'], [email], fail_silently=True) |
70 |
71 |
71 #logging.debug(u"Notification sent [%s] => %s" %(activity,notification.user) if notification.user else u"sending (email) %s => %s" %(activity,notification.email)) |
72 #logging.debug(u"Notification sent [%s] => %s" %(activity,notification.user) if notification.user else u"sending (email) %s => %s" %(activity,notification.email)) |