~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/subscribers/bug.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-03 15:22:48 UTC
  • mfrom: (8758.4.18 garbo-lockfile)
  • Revision ID: launchpad@pqm.canonical.com-20111003152248-cv30fo2i8p0mu5mb
[r=lifeless][bug=553254] Regularly prune LoginToken rows

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from canonical.launchpad.webapp.publisher import canonical_url
23
23
from lp.bugs.adapters.bugchange import (
24
24
    BugDuplicateChange,
25
 
    BugTaskTargetChange,
26
25
    BugTaskAssigneeChange,
27
26
    get_bug_changes,
28
27
    )
33
32
from lp.bugs.mail.newbug import generate_bug_add_email
34
33
from lp.bugs.model.bug import get_also_notified_subscribers
35
34
from lp.registry.interfaces.person import IPerson
36
 
from lp.registry.interfaces.product import IProduct
37
35
from lp.services.mail.sendmail import (
38
36
    format_address,
39
37
    sendmail,
173
171
                        level=change.change_level,
174
172
                        include_master_dupe_subscribers=False))
175
173
                recipients.update(change_recipients)
176
 
            # Additionally, if we are re-targetting a bugtask for a private
177
 
            # bug, we need to ensure the new bug supervisor and maintainer are
178
 
            # notified (if they can view the bug).
179
 
            # If they are the same person, only send one notification.
180
 
            if (isinstance(change, BugTaskTargetChange) and
181
 
                  old_bugtask is not None and bug_delta.bug.private):
182
 
                bugtask_deltas = bug_delta.bugtask_deltas
183
 
                if not isinstance(bugtask_deltas, (list, tuple)):
184
 
                    bugtask_deltas = [bugtask_deltas]
185
 
                for bugtask_delta in bugtask_deltas:
186
 
                    if not bugtask_delta.target:
187
 
                        continue
188
 
                    new_target = bugtask_delta.bugtask.target
189
 
                    if not new_target or not IProduct.providedBy(new_target):
190
 
                        continue
191
 
                    if bug_delta.bug.userCanView(new_target.owner):
192
 
                        recipients.addMaintainer(new_target.owner)
193
 
                    if (new_target.bug_supervisor and not
194
 
                        new_target.bug_supervisor.inTeam(new_target.owner) and
195
 
                        bug_delta.bug.userCanView(new_target.bug_supervisor)):
196
 
                            recipients.addBugSupervisor(
197
 
                                new_target.bug_supervisor)
198
174
            bug_delta.bug.addChange(change, recipients=recipients)
199
175
 
200
176