reviewboard.reviews.views.email¶
Views for e-mail previews.
- class PreviewBatchEmailView(**kwargs)[source]¶
Bases:
ReviewRequestViewMixin
,BasePreviewEmailView
Display a preview of batch e-mails.
This can be used to see what an HTML or plain text e-mail will look like for a batch publish operation.
This supports several query parameters to control what data is included in the preview:
- changedesc_id (int):
The PK of the ChangeDescription for displaying a review request update
- reviews_only (int):
If present, will render as if no review request is being published, only reviews and review replies.
- reviews (comma-separated list of int):
The PKs of reviews to include.
- review_replies (comma-separated list of int):
The PKs of review replies to include.
New in version 6.0.
- static build_email(*, 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 (
list
ofreviewboard.reviews.models.review.Review
) – A list of the reviews that were published in the batch.review_replies (
list
ofreviewboard.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:
EmailMessage
- get_email_data(request: HttpRequest, *args, **kwargs) Dict[str, Any] [source]¶
Return data used for the e-mail builder.
The data returned will be passed to
build_email
to handle rendering the e-mail.This can also return a
HttpResponse
, which is useful for returning errors.- Parameters:
request (
django.http.HttpResponse
) – The HTTP response from the client.*args (
tuple
) – Additional positional arguments passed to the handler.**kwargs (
dict
) – Additional keyword arguments passed to the handler.
- Returns:
The dictionary data to pass as keyword arguments to
build_email
, or an instance ofHttpResponse
to immediately return to the client.- Return type:
- Raises:
django.http.Http404 – The provided change description did not exist.
- __annotations__ = {}¶
- class PreviewReviewRequestEmailView(**kwargs)[source]¶
Bases:
ReviewRequestViewMixin
,BasePreviewEmailView
Display a preview of an e-mail for a review request.
This can be used to see what an HTML or plain text e-mail will look like for a newly-posted review request or an update to a review request.
- static build_email(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 beNone
when 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
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:
EmailMessage
- get_email_data(request: HttpRequest, changedesc_id: Optional[int] = None, *args, **kwargs) Dict[str, Any] [source]¶
Return data used for the e-mail builder.
The data returned will be passed to
build_email
to handle rendering the e-mail.This can also return a
HttpResponse
, which is useful for returning errors.- Parameters:
request (
django.http.HttpResponse
) – The HTTP response from the client.changedesc_id (
int
, optional) – The ID of a change description used when previewing a Review Request Updated e-mail.*args (
tuple
) – Additional positional arguments passed to the handler.**kwargs (
dict
) – Additional keyword arguments passed to the handler.
- Returns:
The dictionary data to pass as keyword arguments to
build_email
, or an instance ofHttpResponse
to immediately return to the client.- Return type:
- __annotations__ = {}¶
- class PreviewReviewEmailView(**kwargs)[source]¶
Bases:
ReviewRequestViewMixin
,BasePreviewEmailView
Display a preview of an e-mail for a review.
This can be used to see what an HTML or plain text e-mail will look like for a review.
- static build_email(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:
EmailMessage
- get_email_data(request: HttpRequest, review_id: int, *args, **kwargs) Dict[str, Any] [source]¶
Return data used for the e-mail builder.
The data returned will be passed to
build_email
to handle rendering the e-mail.This can also return a
HttpResponse
, which is useful for returning errors.- Parameters:
request (
django.http.HttpResponse
) – The HTTP response from the client.review_id (
int
) – The ID of the review to preview.*args (
tuple
) – Additional positional arguments passed to the handler.**kwargs (
dict
) – Additional keyword arguments passed to the handler.
- Returns:
The dictionary data to pass as keyword arguments to
build_email
, or an instance ofHttpResponse
to immediately return to the client.- Return type:
- __annotations__ = {}¶
- class PreviewReplyEmailView(**kwargs)[source]¶
Bases:
ReviewRequestViewMixin
,BasePreviewEmailView
Display a preview of an e-mail for a reply to a review.
This can be used to see what an HTML or plain text e-mail will look like for a reply to a review.
- static build_email(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:
EmailMessage
- get_email_data(request: HttpRequest, review_id: int, reply_id: int, *args, **kwargs) Dict[str, Any] [source]¶
Return data used for the e-mail builder.
The data returned will be passed to
build_email
to handle rendering the e-mail.This can also return a
HttpResponse
, which is useful for returning errors.- Parameters:
request (
django.http.HttpResponse
) – The HTTP response from the client.review_id (
int
) – The ID of the review the reply is for.reply_id (
int
) – The ID of the reply to preview.*args (
tuple
) – Additional positional arguments passed to the handler.**kwargs (
dict
) – Additional keyword arguments passed to the handler.
- Returns:
The dictionary data to pass as keyword arguments to
build_email
, or an instance ofHttpResponse
to immediately return to the client.- Return type:
- __annotations__ = {}¶