~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to cronscripts/send-bug-notifications.py

  • Committer: Brad Crittenden
  • Date: 2011-08-04 00:59:46 UTC
  • mto: (13627.2.1 bug-813322-2)
  • mto: This revision was merged to the branch mainline in revision 13715.
  • Revision ID: bac@canonical.com-20110804005946-030kaefvuljz5j3z
Horrible checkpoint

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from canonical.launchpad.mail import sendmail
23
23
from lp.bugs.enum import BugNotificationStatus
24
24
from lp.bugs.interfaces.bugnotification import IBugNotificationSet
25
 
from lp.bugs.scripts.bugnotification import get_email_notifications
 
25
from lp.bugs.scripts.bugnotification import (
 
26
    get_email_notifications,
 
27
    process_deferred_recipients,
 
28
    )
26
29
from lp.services.scripts.base import LaunchpadCronScript
27
30
 
28
31
 
29
32
class SendBugNotifications(LaunchpadCronScript):
30
33
    def main(self):
31
34
        notifications_sent = False
32
 
        pending_notifications = get_email_notifications(getUtility(
33
 
            IBugNotificationSet).getNotificationsToSend())
 
35
        bug_notification_set = getUtility(IBugNotificationSet)
 
36
        deferred_notifications = bug_notification_set.getDeferredNotifications()
 
37
        process_deferred_notifications(deferred_notifications)
 
38
        pending_notifications = get_email_notifications(
 
39
            bug_notification_set.getNotificationsToSend())
34
40
        for (bug_notifications,
35
41
             omitted_notifications,
36
42
             messages) in pending_notifications:
59
65
    script = SendBugNotifications('send-bug-notifications',
60
66
        dbuser=config.malone.bugnotification_dbuser)
61
67
    script.lock_and_run()
62