reviewboard.reviews.actions¶
Actions for the reviews app.
- class CloseMenuAction[source]¶
Bases:
BaseMenuActionA menu for closing the review request.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class CloseCompletedAction[source]¶
Bases:
BaseActionThe action to close a review request as completed.
New in version 6.0.
- action_id: str = 'close-completed'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_model_class: str = 'RB.CloseCompletedAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class CloseDiscardedAction[source]¶
Bases:
BaseActionThe action to close a review request as discarded.
New in version 6.0.
- action_id: str = 'close-discarded'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_model_class: str = 'RB.CloseDiscardedAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- class DeleteAction[source]¶
Bases:
BaseActionThe action to permanently delete a review request.
New in version 6.0.
- action_id: str = 'delete-review-request'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_model_class: str = 'RB.DeleteAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class DownloadDiffAction[source]¶
Bases:
BaseActionThe action to download a diff.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- get_url(*, context: Context) str[source]¶
Return this action’s URL.
- Parameters:
context (
django.template.Context) – The collection of key-value pairs from the template.- Returns:
The URL to invoke if this action is clicked.
- Return type:
- get_visible(*, context: Context) bool[source]¶
Return whether the action should start visible or not.
- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should start visible.False, otherwise.- Return type:
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class ReviewMenuActionRenderer(*, action: BaseAction, placement: ActionPlacement)[source]¶
Bases:
DetailedMenuActionGroupRendererAction renderer for the Review menu.
This renders as a detailed menu, but using a custom JavaScript view for managing the menu.
New in version 7.1.
- class ReviewMenuAction[source]¶
Bases:
BaseMenuActionThe “Review” menu on the unified banner.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- default_renderer_cls[source]¶
alias of
ReviewMenuActionRenderer
- icon_class: Optional[str] = 'rb-icon rb-icon-compose-review'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This menu only renders when the user is logged in and the unified banner feature is enabled.
- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class CreateReviewAction[source]¶
Bases:
BaseActionAction to create a new, blank review.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- verbose_label: StrOrPromise | None = 'Create a new review'[source]¶
The user-visible verbose label.
This can be used to provide a longer label for wider UIs that would benefit from a more descriptive label. It’s also intended for ARIA labels.
This is always optional.
New in version 7.1.
- description = ['Your review will start off blank, but you can add text and general comments to it.', 'Adding comments to code or file attachments will automatically create a new review for you.'][source]¶
- icon_class: Optional[str] = 'rb-icon rb-icon-create-review'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_model_class: str = 'RB.CreateReviewAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>, <reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This menu only renders when the user is logged in and the unified banner feature is enabled.
- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class EditReviewAction[source]¶
Bases:
BaseActionAction to edit an existing review.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- verbose_label: StrOrPromise | None = 'Edit your review'[source]¶
The user-visible verbose label.
This can be used to provide a longer label for wider UIs that would benefit from a more descriptive label. It’s also intended for ARIA labels.
This is always optional.
New in version 7.1.
- icon_class: Optional[str] = 'rb-icon rb-icon-compose-review'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_model_class: str = 'RB.EditReviewAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>, <reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This menu only renders when the user is logged in and the unified banner feature is enabled.
- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class AddGeneralCommentAction[source]¶
Bases:
BaseActionAction to add a general comment.
New in version 6.0.
- action_id: str = 'add-general-comment'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- verbose_label: StrOrPromise | None = 'Add a general comment'[source]¶
The user-visible verbose label.
This can be used to provide a longer label for wider UIs that would benefit from a more descriptive label. It’s also intended for ARIA labels.
This is always optional.
New in version 7.1.
- description = ['Add a new general comment about the change, not attached to any code or file attachments.'][source]¶
- icon_class: Optional[str] = 'rb-icon rb-icon-edit'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_model_class: str = 'RB.AddGeneralCommentAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>, <reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
New in version 7.1.
- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class ShipItAction[source]¶
Bases:
BaseActionAction to mark a review request as “Ship It”.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- verbose_label: StrOrPromise | None = 'Ship it!'[source]¶
The user-visible verbose label.
This can be used to provide a longer label for wider UIs that would benefit from a more descriptive label. It’s also intended for ARIA labels.
This is always optional.
New in version 7.1.
- description = ["You're happy with what you're seeing, and would like to approve it.", 'If you want to leave a comment with this, choose "Create a new review" above.'][source]¶
- icon_class: Optional[str] = 'rb-icon rb-icon-shipit'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- js_model_class: str = 'RB.ShipItAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>, <reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
New in version 7.1.
- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class LegacyAddGeneralCommentAction[source]¶
Bases:
BaseActionThe action for adding a general comment.
Deprecated since version 7.1: This will be removed in Review Board 9.
New in version 6.0.
- action_id: str = 'legacy-add-general-comment'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class LegacyEditReviewAction[source]¶
Bases:
BaseActionThe old-style “Edit Review” action.
This exists within the review request actions area, and will be supplanted by the new action in the Review menu in the unified banner.
Deprecated since version 7.1: This will be removed in Review Board 9.
New in version 6.0.
- action_id: str = 'legacy-edit-review'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class LegacyShipItAction[source]¶
Bases:
BaseActionThe old-style “Ship It” action.
This exists within the review request actions area, and will be supplanted by the new action in the Review menu in the unified banner.
Deprecated since version 7.1: This will be removed in Review Board 9.
New in version 6.0.
- action_id: str = 'legacy-ship-it'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class UpdateMenuAction[source]¶
Bases:
BaseMenuActionA menu for updating the review request.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class UploadDiffAction[source]¶
Bases:
BaseActionThe action to update or upload a diff.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_model_class: str = 'RB.UpdateDiffAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- get_label(*, context: Context) StrOrPromise[source]¶
Return the label for the action.
- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
The label to use for the action.
- Return type:
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class UploadFileAction[source]¶
Bases:
BaseActionThe action to upload a new file attachment.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_model_class: str = 'RB.AddFileAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class StarActionRenderer(*, action: BaseAction, placement: ActionPlacement)[source]¶
Bases:
BaseActionRendererAction renderer for the starred action.
This provides a custom template used to render the action as a star, which can be pressed to star or unstar the review request.
New in version 7.1.
- class StarAction[source]¶
Bases:
BaseActionThe action to star a review request.
New in version 6.0.
- action_id: str = 'star-review-request'[source]¶
The internal ID of the action.
This must be unique.
- Type:
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- default_renderer_cls[source]¶
alias of
StarActionRenderer
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class ArchiveMenuActionRenderer(*, action: BaseAction, placement: ActionPlacement)[source]¶
Bases:
MenuActionGroupRendererAction renderer for the Archive menu.
This renders as a menu, but using a custom JavaScript view for managing the menu.
New in version 7.1.
- class ArchiveMenuAction[source]¶
Bases:
BaseMenuActionA menu for managing the visibility state of the review request.
New in version 6.0.
- default_renderer_cls[source]¶
alias of
ArchiveMenuActionRenderer
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- icon_class: Optional[str] = 'rb-icon rb-icon-archive-off'[source]¶
A class name to use for an icon.
If specified, this should be the entire class to apply to a <span> element to display an icon. For example, ‘fa fa-rss’.
- Type:
- verbose_label: StrOrPromise | None = 'Archive or Mute'[source]¶
The user-visible verbose label.
This can be used to provide a longer label for wider UIs that would benefit from a more descriptive label. It’s also intended for ARIA labels.
This is always optional.
New in version 7.1.
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- should_render(*, context: Context) bool[source]¶
Return whether this action should render.
This differs from
hiddenin that hidden actions still render but are hidden by CSS, whereas if this returnsFalsethe action will not be included in the DOM at all.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
Trueif the action should render.- Return type:
- class ArchiveAction[source]¶
Bases:
BaseActionAn action for archiving the review request.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_model_class: str = 'RB.ArchiveAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- class MuteAction[source]¶
Bases:
BaseActionAn action for muting the review request.
New in version 6.0.
- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- js_model_class: str = 'RB.MuteAction'[source]¶
The class to instantiate for the JavaScript model.
- Type:
- placements: Sequence[ActionPlacement] | None = [<reviewboard.actions.base.ActionPlacement object>][source]¶
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- class BaseReviewRequestAction[source]¶
Bases:
BaseActionA base class for an action that can be applied to a review request.
Creating an action requires subclassing
BaseReviewRequestActionand overriding any fields/methods as desired. Different instances of the same subclass can also override the class fields with their own instance fields.Example
class UsedOnceAction(BaseReviewRequestAction): action_id = 'once' label = 'This is used once.' class UsedMultipleAction(BaseReviewRequestAction): def __init__(self, action_id, label): super().__init__() self.action_id = 'repeat-' + action_id self.label = 'This is used multiple times,'
Note
Since the same action will be rendered for multiple different users in a multithreaded environment, the action state should not be modified after initialization. If we want different action attributes at runtime, then we can override one of the getter methods (such as
get_label()), which by default will simply return the original attribute from initialization.Deprecated since version 6.0: New code should be written using
reviewboard.actions.base.BaseAction. This class will be removed in 8.0.- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- __init__() None[source]¶
Initialize this action.
By default, actions are top-level and have no children.
- property max_depth: int[source]¶
Lazily compute the max depth of any action contained by this action.
Top-level actions have a depth of zero, and child actions have a depth that is one more than their parent action’s depth.
Algorithmically, the notion of max depth is equivalent to the notion of height in the context of trees (from graph theory). We decided to use this term instead so as not to confuse it with the dimensional height of a UI element.
- Returns:
The max depth of any action contained by this action.
- Return type:
- get_dom_element_id() str[source]¶
Return the ID used for the DOM element for this action.
- Returns:
The ID used for the element.
- Return type:
- get_extra_context(*, request: HttpRequest, context: Context) dict[source]¶
Return extra template context for the action.
- Parameters:
request (
django.http.HttpRequest) – The HTTP request from the client.context (
django.template.Context) – The current rendering context.
- Returns:
Extra context to use when rendering the action’s template.
- Return type:
- copy_to_dict(context: Context) dict[source]¶
Copy this action instance to a dictionary.
This is a legacy implementation left to maintain compatibility with custom templates.
- register(parent: Optional[BaseReviewRequestMenuAction] = None) None[source]¶
Register this review request action instance.
Note
Newly registered top-level actions are appended to the left of the other previously registered top-level actions. So if we intend to register a collection of top-level actions in a certain order, then we likely want to iterate through the actions in reverse.
- Parameters:
parent (
BaseReviewRequestMenuAction, optional) – The parent action instance of this action instance.- Raises:
KeyError – A second registration is attempted (action IDs must be unique across all types of actions and menu actions, at any depth).
DepthLimitExceededError – The maximum depth limit is exceeded.
- unregister() None[source]¶
Unregister this review request action instance.
Note
This method can mutate its parent’s child actions. So if we are iteratively unregistering a parent’s child actions, then we should consider first making a clone of the list of children.
- Raises:
KeyError – An unregistration is attempted before it’s registered.
- class BaseReviewRequestMenuAction(child_actions: Optional[List[BaseReviewRequestAction]] = None)[source]¶
Bases:
BaseMenuActionA base class for an action with a dropdown menu.
Deprecated since version 6.0: New code should be written using
reviewboard.actions.base.BaseMenuAction. This class will be removed in 8.0.- apply_to: Optional[List[str]] = ['view-diff', 'view-interdiff', 'view-diff-revision', 'file-attachment', 'screenshot', 'view-diff', 'view-interdiff', 'view-diff-revision', 'review-request-detail'][source]¶
A list of URLs to apply to.
If this is
None, the action will be loaded on all pages. Otherwise, it will be limited to the URLs listed here.
- __init__(child_actions: Optional[List[BaseReviewRequestAction]] = None) None[source]¶
Initialize this menu action.
- Parameters:
child_actions (
listofBaseReviewRequestAction, optional) – The list of child actions to be contained by this menu action.- Raises:
KeyError – A second registration is attempted (action IDs must be unique across all types of actions and menu actions, at any depth).
DepthLimitExceededError – The maximum depth limit is exceeded.
- get_dom_element_id() str[source]¶
Return the ID used for the DOM element for this action.
- Returns:
The ID used for the element.
- Return type:
- copy_to_dict(context: Context) dict[source]¶
Copy this menu action instance to a dictionary.
This is a legacy implementation left to maintain compatibility with custom templates.
- Parameters:
context (
django.template.Context) – The collection of key-value pairs from the template.- Returns:
The corresponding dictionary.
- Return type:
- get_extra_context(*, request: HttpRequest, context: Context) dict[source]¶
Return extra template context for the action.
- Parameters:
request (
django.http.HttpRequest) – The HTTP request from the client.context (
django.template.Context) – The current rendering context.
- Returns:
Extra context to use when rendering the action’s template.
- Return type:
- property max_depth: int[source]¶
Lazily compute the max depth of any action contained by this action.
- Returns:
The max depth of any action contained by this action.
- Return type:
- register(parent: Optional[BaseReviewRequestMenuAction] = None) None[source]¶
Register this review request action instance.
Note
Newly registered top-level actions are appended to the left of the other previously registered top-level actions. So if we intend to register a collection of top-level actions in a certain order, then we likely want to iterate through the actions in reverse.
- Parameters:
parent (
BaseReviewRequestMenuAction, optional) – The parent action instance of this action instance.- Raises:
KeyError – A second registration is attempted (action IDs must be unique across all types of actions and menu actions, at any depth).
DepthLimitExceededError – The maximum depth limit is exceeded.
- register_actions(actions: List[Union[BaseReviewRequestAction, BaseReviewRequestMenuAction]], parent_id: Optional[str] = None) None[source]¶
Register the given actions as children of the corresponding parent.
If no parent_id is given, then the actions are assumed to be top-level.
Deprecated since version 6.0: Users should switch to
reviewboard.actions.actions_registry. This method will be removed in Review Board 8.- Parameters:
actions (
iterableofBaseReviewRequestAction) – The collection of action instances to be registered.parent_id (
unicode, optional) – The action ID of the parent of each action instance to be registered.
- Raises:
KeyError – The parent action cannot be found or a second registration is attempted (action IDs must be unique across all types of actions and menu actions, at any depth).
DepthLimitExceededError – The maximum depth limit is exceeded.
- unregister_actions(action_ids: Iterable[str]) None[source]¶
Unregister each of the actions corresponding to the given IDs.
Deprecated since version 6.0: Users should switch to
reviewboard.actions.actions_registry. This method will be removed in Review Board 8.
- clear_all_actions() None[source]¶
Clear all registered actions.
This method is really only intended to be used by unit tests. We might be able to remove this hack once we convert to djblets.registries.
Deprecated since version 6.0: Users should switch to
reviewboard.actions.actions_registry. This method will be removed in Review Board 8.Warning
This will clear all actions, even if they were registered in separate extensions.