reviewboard.notifications.email.message¶
The Review Board e-mail message class and methods for generating e-mails.
- HEADER_ADDITIONAL_CHARACTERS_LENGTH = 26[source]¶
The number of additional characters each
X-ReviewBoard-Diff-Forhas.We calculate the length the value of each header at runtime. However,
X-ReviewBoard-Diff-For: `` is present before the value, and the line terminates with a ``\r\n.
- class EmailMessage(*args, **kwargs)[source]¶
Bases:
EmailMessageAn e-mail message.
This class only differs from Djblets’
EmailMessageby using the site configuration to generate some e-mail settings.- __annotations__ = {}¶
- prepare_base_review_request_mail(user: User, review_request: ReviewRequest, subject: str, in_reply_to: Optional[str], to_field: Collection[Union[User, Group]], cc_field: Collection[Union[User, Group]], template_name_base: str, context: Optional[dict] = None, extra_headers: Optional[dict] = None) Optional[EmailMessage][source]¶
Return a customized review request e-mail.
This is intended to be called by one of the
prepare_{type}_mailfunctions in this file. This method builds up a common context that all review request-related e-mails will use to render their templates, as well as handling user preferences regarding e-mail and add adding additional headers.- Parameters:
user (
django.contrib.auth.models.User) – The user who is sending the e-mail.review_request (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request this e-mail is regarding.subject (
str) – The e-mail subject line.in_reply_to (
str) – The e-mail message ID this message is in response to orNone.to_field (
set) – The set ofUserand :py:class`~reviewboard.reviews.models.group.Group`s to this e-mail will be sent to.cc_field (
set) – The set ofUserand :py:class`~reviewboard.reviews.models.group.Group`s to be CC’ed on the e-mail.template_name_base (
str) – The name of the template to use to generate the e-mail without its extension. The plain-text version of the e-mail will append.txtto this and and the rich-text version of the e-mail will append.html.context (
dict, optional) – Optional additional template rendering context.extra_headers (
dict, optional) – Optional additional headers to include.
- Returns:
The prepared e-mail message.
- Return type:
- prepare_password_changed_mail(user: User) EmailMessage[source]¶
Return an e-mail notifying the user that their password changed.
- Parameters:
user (
django.contrib.auth.models.User) – The user whose password changed.- Returns:
The generated message.
- Return type:
- prepare_reply_published_mail(user: User, reply: Review, review: Review, review_request: ReviewRequest) EmailMessage[source]¶
Return an e-mail representing the supplied reply to a review.
- Parameters:
user (
django.contrib.auth.models.User) – The user who published the reply.reply (
reviewboard.reviews.models.review.Review) – The review reply to send an e-mail about.review (
reviewboard.reviews.models.review.Review) – The review that was replied to.review_request (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request.
- Returns:
The generated e-mail message.
- Return type:
- prepare_review_published_mail(user: User, review: Review, review_request: ReviewRequest, request: HttpRequest, to_owner_only: bool = False) EmailMessage[source]¶
Return an e-mail representing the supplied review.
- Parameters:
user (
django.contrib.auth.models.User) – The user who published the review.review (
reviewboard.reviews.models.review.Review) – The review to send an e-mail about.review_request (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request that was reviewed.to_owner_only (
bool) – Whether or not the review should be sent to the submitter only.
- Returns:
The generated e-mail message.
- Return type:
- prepare_review_request_mail(user: User, review_request: ReviewRequest, changedesc: Optional[ChangeDescription] = None, close_type: Optional[str] = None) EmailMessage[source]¶
Return an e-mail representing the supplied review request.
- Parameters:
user (
django.contrib.auth.models.User) – The user who triggered the e-mail (i.e., they published or closed the review request).review_request (
reviewboard.reviews.models.ReviewRequest) – The review request to send an e-mail about.changedesc (
reviewboard.changedescs.models.ChangeDescription) – An optional change description showing what has changed in the review request, possibly with explanatory text from the submitter. This is created when saving a draft on a public review request and will beNonewhen publishing initially. This is used by the template to add contextual (updated) flags to inform people what has changed.close_type (
str) –How the review request was closed or
Noneif it was published. If this is notNoneit must be one of:
- Returns:
The e-mail message representing the review request.
- Return type:
- prepare_batch_review_request_mail(*, user: Optional[User], review_request: ReviewRequest, review_request_changed: bool, changedesc: Optional[ChangeDescription], reviews: List[Review], review_replies: List[Review], request: HttpRequest) Optional[EmailMessage][source]¶
Return an e-mail with batched review request and reviews.
New in version 6.0.
- Parameters:
user (
django.contrib.auth.models.User) – The user who triggered the e-mail (i.e., they published the review request and/or reviews).review_request (
reviewboard.reviews.models.review_request.ReviewRequest) – The review request. This is present whether or not the review request was actually published in the batch.review_request_changed (
bool) – Whether the review request was published or updated.changedesc (
reviewboard.changedescs.models.ChangeDescription) – The change description showing what changed in the review request (if an update to the review request was published).reviews (
listofreviewboard.reviews.models.review.Review) – A list of the reviews that were published in the batch.review_replies (
listofreviewboard.reviews.models.review.Review) – A list of the review replies that were published in the batch.request (
django.http.HttpRequest) – The current request from the client.
- Returns:
The e-mail message including all of the batched updates.
- Return type:
- prepare_user_registered_mail(user: User) EmailMessage[source]¶
Prepare an e-mail to the administrators notifying of a new user.
- Parameters:
user (
django.contrib.auth.models.User) – The user who registered.- Returns:
The generated e-mail.
- Return type:
- prepare_webapi_token_mail(webapi_token: WebAPIToken, op: str) EmailMessage[source]¶
Return an e-mail message notifying a user about a WebAPI token change.
- Parameters:
webapi_token (
reviewboard.notifications.models.WebAPIToken) – The token that was created, updated, deleted, or expired.op (
str) –The operation on the token. This is one of:
'created''updated''deleted''expired'
- Returns:
The generated e-mail.
- Return type: