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

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

Known subclasses: lp.code.mail.branchmergeproposal.BMPMailer

Send email notifications about a branch.
Method __init__ Constructor.
Class Method forBranchModified Construct a BranchMailer for mail about a branch modification.
Class Method forRevision Construct a BranchMailer for mail about branch revisions.
Method _getHeaders Return the mail headers to use.
Method _getTemplateParams Return a dict of values to use in the body and subject.
Method _includeDiff Determine whether to include a diff, and explanation.
Method _explainNotPresentDiff Provide an explanation why the diff is not being included.
Method _addAttachments Attach the diff, if present and not too large.

Inherited from BaseMailer:

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 sendAll Send notifications to all recipients.
Method _getFromAddress Undocumented
Method _getToAddresses Undocumented
Method _getSubject The subject template expanded with the template params.
Method _getReplyToAddress Return the address to use for the reply-to header.
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, from_address, delta=None, delta_for_editors=None, contents=None, diff=None, message_id=None, revno=None, revision_id=None, notification_type=None, **kwargs):
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.
@classmethod
def forBranchModified(cls, branch, user, delta, delta_for_editors=None):
Construct a BranchMailer for mail about a branch modification.
ParametersbranchThe branch that was modified.
userThe user making the change.
deltaan IBranchDelta representing the modification as visible to people who cannot edit the branch.
delta_for_editorsan IBranchDelta representing the notification as visible to people who can edit the branch. If None, delta is used for people who can edit the branch too.
Returnsa BranchMailer.
@classmethod
def forRevision(cls, db_branch, from_address, contents, diff, subject, revno=None, revision_id=None):
Construct a BranchMailer for mail about branch revisions.
ParametersbranchThe db_branch that was modified.
revnoThe revno of the revision this message is about.
from_addressThe email address this message should come from.
contentsThe contents of the message.
subjectThe subject of the message
diffThe diff of this revision versus its parent, as text.
Returnsa BranchMailer.
def _getHeaders(self, email, recipient):
Return the mail headers to use.
def _getTemplateParams(self, email, recipient):
Return a dict of values to use in the body and subject.
def _includeDiff(self, email):
Determine whether to include a diff, and explanation.

Explanation is provided if the diff is wanted and present, but is too large.

def _explainNotPresentDiff(self, email):
Provide an explanation why the diff is not being included.

No explanation is provided where the diff is empty or where the user has requested to never have diffs sent.

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.
API Documentation for Launchpad, generated by pydoctor at 2019-05-25 00:00:03.