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-For
has.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:
djblets.mail.message.EmailMessage
An e-mail message.
This class only differs from Djblets’
EmailMessage
by using the site configuration to generate some e-mail settings.
-
prepare_base_review_request_mail
(user, review_request, subject, in_reply_to, to_field, cc_field, template_name_base, context=None, extra_headers=None)[source]¶ Return a customized review request e-mail.
This is intended to be called by one of the
prepare_{type}_mail
functions 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 (unicode) – The e-mail subject line.
- in_reply_to (unicode) – The e-mail message ID this message is in response to or
None
. - to_field (set) – The set of
User
and :py:class`~reviewboard.reviews.models.group.Group`s to this e-mail will be sent to. - cc_field (set) – The set of
User
and :py:class`~reviewboard.reviews.models.group.Group`s to be CC’ed on the e-mail. - template_name_base (unicode) – 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
.txt
to 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)[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: EmailMessage
-
prepare_reply_published_mail
(user, reply, review, review_request)[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, review, review_request, request, to_owner_only=False)[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, review_request, changedesc=None, close_type=None)[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 he 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 be
None
when publishing initially. This is used by the template to add contextual (updated) flags to inform people what has changed. - close_type (unicode) –
How the review request was closed or
None
if it was published. If this is notNone
it must be one of:
Returns: The e-mail message representing the review request.
Return type:
-
prepare_user_registered_mail
(user)[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: EmailMessage
-
prepare_webapi_token_mail
(webapi_token, op)[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, or deleted.
- op (unicode) –
The operation on the token. This is one of:
'created'
'updated'
'deleted'
Returns: The genereated e-mail.
Return type: