~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/scripts/personnotification.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-05-19 09:35:32 UTC
  • mfrom: (13082.1.3 bug-784948)
  • Revision ID: launchpad@pqm.canonical.com-20110519093532-ig34h74kzmqb2ejj
[r=lifeless,
 stevenk][bug=784948] PersonNotificationManager.sendNotifications
 won't crash when sending email to admins of a team without a contact address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
import pytz
17
17
from zope.component import getUtility
18
 
from zope.security.proxy import removeSecurityProxy
19
18
 
20
19
from canonical.config import config
21
20
from lp.registry.interfaces.personnotification import IPersonNotificationSet
43
42
                self.logger.info(
44
43
                    "%s has no email address." % person.name)
45
44
                continue
46
 
            self.logger.info(
47
 
                "Sending notification to %s <%s>."
48
 
                % (person.name,
49
 
                   removeSecurityProxy(person).preferredemail.email))
50
 
            notification.send()
 
45
            self.logger.info("Notifying %s." % person.name)
 
46
            notification.send(logger=self.logger)
51
47
            notifications_sent = True
52
48
            # Commit after each email sent, so that we won't re-mail the
53
49
            # notifications in case of something going wrong in the middle.