l.b.s.bugnotification : module documentation

Part of lp.bugs.scripts

Functions related to sending bug notifications.
Function get_activity_key Given a notification, return a key for the activity if it exists.
Function construct_email_notifications Construct an email from a list of related bug notifications.
Function notification_comment_batches Search notification for continuous spans with only one comment.
Function get_bug_and_owner Retrieve notification's bug and message.owner attributes.
Function notification_batches Batch notifications for get_email_notifications.
Function get_email_notifications Return the email notifications pending to be sent.
Function process_deferred_notifications Transform deferred notifications into real ones.
Class SendBugNotifications Undocumented
def get_activity_key(notification):
Given a notification, return a key for the activity if it exists.

The key will be used to determine whether changes for the activity are undone within the same batch of notifications (which are supposed to be all for the same bug when they get to this function). Therefore, the activity's attribute is a good start for the key.

If the activity was on a bugtask, we will also want to distinguish by bugtask, because, for instance, changing a status from INPROGRESS to FIXCOMMITED on one bug task is not undone if the status changes from FIXCOMMITTED to INPROGRESS on another bugtask.

Similarly, if the activity is about adding or removing something that we can have multiple of, like a branch or an attachment, the key should include information on that value, because adding one attachment is not undone by removing another one.

def construct_email_notifications(bug_notifications):
Construct an email from a list of related bug notifications.

The person and bug has to be the same for all notifications, and there can be only one comment.

def notification_comment_batches(notifications):
Search notification for continuous spans with only one comment.

Generates comment_group, notification tuples.

The notifications are searched in order for continuous spans containing only one comment. Each continous span is given a unique number. Each notification is yielded along with its span number.

def get_bug_and_owner(notification):
Retrieve notification's bug and message.owner attributes.
def notification_batches(notifications):
Batch notifications for get_email_notifications.
def get_email_notifications(bug_notifications):
Return the email notifications pending to be sent.

The intention of this code is to ensure that as many notifications
as possible are batched into a single email. The criteria is that
the notifications:
    - Must share the same owner.
    - Must be related to the same bug.
    - Must contain at most one comment.
def process_deferred_notifications(bug_notifications):
Transform deferred notifications into real ones.

Deferred notifications must have their recipients list calculated and then re-inserted as real notifications.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.