@@ -0,0 +1,1887 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A##%0A## Author: Adriano Monteiro Marques %3Cadriano@umitproject.org%3E%0A## Author: Orcun Avsar %3Corc.avs%5Bat%5Dgmail.com%3E%0A##%0A## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA%0A##%0A## This program is free software: you can redistribute it and/or modify%0A## it under the terms of the GNU Affero General Public License as%0A## published by the Free Software Foundation, either version 3 of the%0A## License, or (at your option) any later version.%0A##%0A## This program is distributed in the hope that it will be useful,%0A## but WITHOUT ANY WARRANTY; without even the implied warranty of%0A## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A## GNU Affero General Public License for more details.%0A##%0A## You should have received a copy of the GNU Affero General Public License%0A## along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A##%0A%0A%22%22%22Module containing shortcut functions to easily send tweets.%0A%22%22%22%0A%0A%0Adef send_notifications_task(notification_id=None):%0A    %22%22%22Task that sends out notifications.%0A    %22%22%22%0A%0A    if notification_id:%0A        notifications = %5BEmailNotification.objects.get(pk=notification_id)%5D%0A    else:%0A        notifications = EmailNotification.objects.filter(%0A            sent_at=None, send=True).order_by('-created_at')%0A%0A    for notification in notifications:%0A        notification.build_email_data()%0A        sent = send_mail(settings.NOTIFICATION_SENDER,%0A                         settings.NOTIFICATION_TO,%0A                         bcc=notification.list_emails,%0A                         reply_to=settings.NOTIFICATION_REPLY_TO,%0A                         subject=notification.subject,%0A                         body=notification.body,%0A                         html=notification.html)%0A%0A        notification.sent_at = datetime.datetime.now()%0A        notification.save()%0A%0A    return HttpResponse(%22OK%22)%0A

Refactor notificationsystem app to use djcelery based tasks.