l.c.m.b.BMPMailer(BranchMailer) : class documentation

Part of lp.code.mail.branchmergeproposal View In Hierarchy

Known subclasses: lp.code.mail.codereviewcomment.CodeReviewCommentMailer

Send mailings related to BranchMergeProposal events.
Method __init__ Constructor.
Method sendAll Send notifications to all recipients.
Class Method forCreation Return a mailer for BranchMergeProposal creation.
Class Method forModification Return a mailer for BranchMergeProposal creation.
Class Method forReviewRequest Return a mailer for a request to review a BranchMergeProposal.
Method _getReplyToAddress Return the address to use for the reply-to header.
Method _getToAddresses Return the addresses to use for the to header.
Method _getHeaders Return the mail headers to use.
Method _addAttachments Attach the diff, if present and not too large.
Method _generateTemplateParams For template params that don't change, calculate just once.
Method _formatExtraInformation Consistently indent the chunks with the heading.
Method _getCommitMessage Return a string describing the commit message, if any.
Method _getRequestedReviews Return a string describing the requested reviews, if any.
Method _getRelatedBugTasks Return a string describing related bug tasks, if any.
Method _getTemplateParams Return a dict of values to use in the body and subject.

Inherited from BranchMailer:

Class Method forBranchModified Construct a BranchMailer for mail about a branch modification.
Class Method forRevision Construct a BranchMailer for mail about branch revisions.
Method _includeDiff Determine whether to include a diff, and explanation.
Method _explainNotPresentDiff Provide an explanation why the diff is not being included.

Inherited from BaseMailer (via BranchMailer):

Method generateEmail Generate the email for this recipient.
Method textDelta Return a textual version of the class delta.
Method sendOne Send notification to one recipient.
Method _getFromAddress Undocumented
Method _getSubject The subject template expanded with the template params.
Method _getTemplateName Return the name of the template to use for this email body.
Method _getBody Return the complete body to use for this email.
Method _getFooter Provide a footer to attach to the body, or None.
Method _getExpandedFooter Provide an expanded footer for recipients who have requested it.
def __init__(self, subject, template_name, recipients, merge_proposal, from_address, delta=None, message_id=None, requested_reviews=None, preview_diff=None, direct_email=False):
Constructor.
ParameterssubjectA Python dict-replacement template for the subject line of the email.
templateName of the template to use for the message body.
recipientsA dict of recipient to Subscription.
from_addressThe from_address to use on emails.
deltaA Delta object with members "delta_values", "interface" and "new_values", such as BranchMergeProposalDelta.
message_idThe Message-Id to use for generated emails. If not supplied, random message-ids will be used.
mail_controller_classThe class of the mail controller to use to send the mails. Defaults to MailController.
requestAn optional IErrorReportRequest to use when logging OOPSes.
wrapWrap body text using MailWrapper.
force_wrapSee MailWrapper.format.
def sendAll(self):
Send notifications to all recipients.
@classmethod
def forCreation(cls, merge_proposal, from_user):
Return a mailer for BranchMergeProposal creation.
Parametersmerge_proposalThe BranchMergeProposal that was created.
from_userThe user that the creation notification should come from.
@classmethod
def forModification(cls, merge_proposal, delta_text, from_user):
Return a mailer for BranchMergeProposal creation.
Parametersmerge_proposalThe BranchMergeProposal that was created.
from_userThe user that the creation notification should come from. Optional.
@classmethod
def forReviewRequest(cls, reason, merge_proposal, from_user):
Return a mailer for a request to review a BranchMergeProposal.
def _getReplyToAddress(self, email, recipient):
Return the address to use for the reply-to header.
def _getToAddresses(self, email, recipient):
Return the addresses to use for the to header.

If the email is being sent directly to the recipient, their email address is returned. Otherwise, the merge proposal and requested reviewers are returned.

def _getHeaders(self, email, recipient):
Return the mail headers to use.
def _addAttachments(self, ctrl, email):
Attach the diff, if present and not too large.
ParametersctrlThe MailController to attach the diff to.
emailEmail address of the recipient.
def _generateTemplateParams(self):
For template params that don't change, calculate just once.
def _formatExtraInformation(self, heading, chunks):
Consistently indent the chunks with the heading.

Used to provide consistent indentation for requested reviews and related bugs.

def _getCommitMessage(self):
Return a string describing the commit message, if any.
def _getRequestedReviews(self):
Return a string describing the requested reviews, if any.
def _getRelatedBugTasks(self, recipient):
Return a string describing related bug tasks, if any.

Related bugs are provided by IBranchMergeProposal.getRelatedBugTasks

def _getTemplateParams(self, email, recipient):
Return a dict of values to use in the body and subject.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.