379
379
>>> linux_source_bug.getSubscribersFromDuplicates()
382
When a bug is marked private, specific people like the bugtask bug supervisors
383
will be automatically subscribed, and only specifically allowed existing
384
direct subscribers (eg bugtask pillar maintainers) will remain subscribed.
382
When a bug is marked private, all its indirect subscribers become direct
386
385
>>> from zope.event import notify
404
403
>>> print_displayname(linux_source_bug.getDirectSubscribers())
409
A private bug never has indirect subscribers. Let's add an indirect subscriber
410
to show that they still aren't included in the indirect subscriptions.
412
A private bug never has indirect subscribers. Since all our indirect
413
subscribers have been made into direct subscribers, let's add another
414
indirect subscriber to show that they still aren't included in the
415
indirect subscriptions.
412
417
>>> linux_source_bug.bugtasks[0].transitionToAssignee(
413
418
... personset.getByName("martin-pitt"))
418
423
>>> linux_source_bug.getSubscribersFromDuplicates()
421
Direct subscriptions always take precedence over indirect subscriptions.
422
So, if we unmark the above bug as private, indirect_subscribers will include
423
any subscribers not converted to direct subscribers.
426
Direct subscriptions always take precedence over indirect
427
subscriptions. So, if we unmark the above bug as private,
428
indirect_subscribers will include only martin-pitt.
425
430
>>> linux_source_bug.setPrivate(False, getUtility(ILaunchBag).user)
429
434
>>> print_displayname(linux_source_bug.getDirectSubscribers())
434
443
>>> print_displayname(linux_source_bug.getIndirectSubscribers())
440
446
>>> print_displayname(linux_source_bug.getAlsoNotifiedSubscribers())
446
449
To find out which email addresses should receive a notification email on
447
450
a bug, and why, IBug.getBugNotificationRecipients() assembles an
454
457
>>> addresses = recipients.getEmails()
455
458
>>> [(address, recipients.getReason(address)[1]) for address in addresses]
456
459
[('foo.bar@canonical.com', 'Subscriber'),
457
('no-priv@canonical.com', u'Subscriber (linux-source-2.6.15 in Ubuntu)'),
460
('mark@example.com', 'Subscriber'),
461
('no-priv@canonical.com', 'Subscriber'),
458
462
('robertc@robertcollins.net', 'Subscriber'),
459
463
('support@ubuntu.com', u'Subscriber @ubuntu-team'),
460
('test@canonical.com', 'Assignee')]
464
('test@canonical.com', 'Subscriber')]
462
466
If IBug.getBugNotificationRecipients() is passed a BugNotificationLevel
463
467
in its `level` parameter, only structural subscribers with that
464
notification level or higher will be returned.
468
notification level or higher will be returned. When the linux_source_bug
469
was temporarily set to "private", the structural subscriber Sample Person
470
was directly subscribed, thus he is returned by
471
getBugNotificationRecipients() even if the parameter level is larger than
472
his structural subscription setting.
466
474
>>> recipients = linux_source_bug.getBugNotificationRecipients(
467
475
... level=BugNotificationLevel.COMMENTS)
468
476
>>> addresses = recipients.getEmails()
469
477
>>> [(address, recipients.getReason(address)[1]) for address in addresses]
470
478
[('foo.bar@canonical.com', 'Subscriber'),
479
('mark@example.com', 'Subscriber'),
480
('no-priv@canonical.com', 'Subscriber'),
471
481
('robertc@robertcollins.net', 'Subscriber'),
472
482
('support@ubuntu.com', u'Subscriber @ubuntu-team'),
473
('test@canonical.com', 'Assignee')]
483
('test@canonical.com', 'Subscriber')]
475
485
When Sample Person is unsubscribed from linux_source_bug, he is no
476
486
longer included in the result of getBugNotificationRecipients() for
482
492
>>> addresses = recipients.getEmails()
483
493
>>> [(address, recipients.getReason(address)[1]) for address in addresses]
484
494
[('foo.bar@canonical.com', 'Subscriber'),
495
('mark@example.com', 'Subscriber'),
485
496
('robertc@robertcollins.net', 'Subscriber'),
486
497
('support@ubuntu.com', u'Subscriber @ubuntu-team'),
487
('test@canonical.com', 'Assignee')]
498
('test@canonical.com', 'Subscriber')]
489
500
...but remains included for the level LIFECYCLE.
494
505
>>> addresses = recipients.getEmails()
495
506
>>> [(address, recipients.getReason(address)[1]) for address in addresses]
496
507
[('foo.bar@canonical.com', 'Subscriber'),
508
('mark@example.com', 'Subscriber'),
497
509
('no-priv@canonical.com', u'Subscriber (linux-source-2.6.15 in Ubuntu)'),
498
510
('robertc@robertcollins.net', 'Subscriber'),
499
511
('support@ubuntu.com', u'Subscriber @ubuntu-team'),
500
('test@canonical.com', 'Assignee')]
512
('test@canonical.com', 'Subscriber')]
502
514
To find out if someone is already directly subscribed to a bug, call
503
515
IBug.isSubscribed, passing in an IPerson:
505
517
>>> linux_source_bug.isSubscribed(personset.getByName("debonzi"))
507
>>> name16 = personset.getByName("name16")
508
>>> linux_source_bug.isSubscribed(name16)
519
>>> linux_source_bug.isSubscribed(sample_person)
511
522
Call isSubscribedToDupes to see if a user is directly subscribed to