Jump to >

reviewboard.reviews.conditions

Condition choices and operators for review requests and related objects.

class ReviewRequestConditionChoiceMixin[source]

Bases: object

Mixin for condition choices that operate off review requests.

This will set state needed to match against the choice.

value_kwarg = 'review_request'[source]
class AnyReviewGroupsPublicOperator(choice)[source]

Bases: djblets.conditions.operators.BaseConditionOperator

An operator for matching against any public review groups.

operator_id = 'any-public'[source]

The ID of the operator.

This must be unique within a BaseConditionChoice.

name = 'Are any public'[source]

The displayed name for the operator.

value_field = None[source]
matches(match_value, **kwargs)[source]

Return whether any review groups are public.

Parameters
Returns

True if any review groups are public. False if all are invite-only or the list is empty.

Return type

bool

class AllReviewGroupsInviteOnlyOperator(choice)[source]

Bases: djblets.conditions.operators.BaseConditionOperator

An operator for matching against all invite-only review groups.

operator_id = 'all-invite-only'[source]

The ID of the operator.

This must be unique within a BaseConditionChoice.

name = 'Are all invite-only'[source]

The displayed name for the operator.

value_field = None[source]
matches(match_value, **kwargs)[source]

Return whether all review groups in the list are invite-only.

Parameters
Returns

True if all review group in the list are invite-only. False if any are public, or the list is empty.

Return type

bool

__annotations__ = {}
class ReviewGroupsChoice(**kwargs)[source]

Bases: djblets.conditions.choices.BaseConditionModelMultipleChoice

A condition choice for matching review groups.

This is used to match a Group against a list of groups, against no group (empty list), or against a group’s public/invite-only state.

choice_id = 'review-groups'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Review groups'[source]

The displayed name for the choice.

value_kwarg = 'review_groups'[source]

The keyword argument required for condition matching.

This is the name of the keyword argument that must be provided in order for this choice to be considered for matching. By default, this expects a value= keyword argument to be passed to Condition.match, but choices can specify another name instead.

This allows multiple choices with different expected values to be used in the same ConditionSet.

operators = <djblets.conditions.operators.ConditionOperators object>[source]

The operators for this choice.

This must be set to an instance of ConditionOperators.

get_queryset()[source]

Return the queryset used to look up review group choices.

Returns

The queryset for review groups.

Return type

django.db.models.query.QuerySet

get_match_value(review_groups, value_state_cache, **kwargs)[source]

Return the review groups used for matching.

Parameters
Returns

The list of review groups.

Return type

list of reviewboard.reviews.models.group.Group

class ReviewRequestBranchChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, djblets.conditions.choices.BaseConditionStringChoice

A condition choice for matching a review request’s branch.

choice_id = 'branch'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Branch'[source]

The displayed name for the choice.

get_match_value(review_request, **kwargs)[source]

Return the branch text used for matching.

Parameters
Returns

The review request’s branch text.

Return type

unicode

__annotations__ = {}
class ReviewRequestDescriptionChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, djblets.conditions.choices.BaseConditionStringChoice

A condition choice for matching a review request’s description.

choice_id = 'description'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Description'[source]

The displayed name for the choice.

get_match_value(review_request, **kwargs)[source]

Return the description text used for matching.

Parameters
Returns

The review request’s description text.

Return type

unicode

__annotations__ = {}
class BaseReviewRequestDiffFileChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, djblets.conditions.choices.ConditionChoiceMatchListItemsMixin, djblets.conditions.choices.BaseConditionStringChoice

A condition choice for matching affected diff files on a review request.

This matches against a list of file paths that were added/modified/deleted on the latest diffset of a review request.

get_match_value(review_request, value_state_cache, **kwargs)[source]

Return the list of filenames used for matching.

Parameters
Returns

The set of filenames.

Return type

set of unicode

__annotations__ = {}
class ReviewRequestAnyDiffFileChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.BaseReviewRequestDiffFileChoice

choice_id = 'any_diffed_file'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Any diffed file'[source]

The displayed name for the choice.

require_match_all_items = False[source]

Whether all items must match for the choice’s match to be successful.

By default, the match is successful if any item in the list matches. If True, all items must match.

__annotations__ = {}
class ReviewRequestAllDiffFilesChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.BaseReviewRequestDiffFileChoice

choice_id = 'all_diffed_files'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'All diffed file'[source]

The displayed name for the choice.

require_match_all_items = True[source]

Whether all items must match for the choice’s match to be successful.

By default, the match is successful if any item in the list matches. If True, all items must match.

__annotations__ = {}
class ReviewRequestOwnerChoice(**kwargs)[source]

Bases: reviewboard.site.conditions.LocalSiteModelChoiceMixin, reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, djblets.conditions.choices.BaseConditionModelMultipleChoice

A condition choice for matching a review request’s owner.

queryset = <QuerySet [<User: admin>, <User: doc>, <User: dopey>, <User: grumpy>]>[source]

The queryset used for the choice.

choice_id = 'owner'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Owner'[source]

The displayed name for the choice.

operators = <djblets.conditions.operators.ConditionOperators object>[source]

The operators for this choice.

This must be set to an instance of ConditionOperators.

get_match_value(review_request, **kwargs)[source]

Return the owner used for matching.

Parameters
Returns

The review request’s owner.

Return type

django.contrib.auth.models.User

__annotations__ = {}
class ReviewRequestReviewerChoice(**kwargs)[source]

Bases: reviewboard.site.conditions.LocalSiteModelChoiceMixin, reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, djblets.conditions.choices.BaseConditionModelMultipleChoice

A condition choice for matching a review request’s reviewer.

queryset = <QuerySet [<User: admin>, <User: doc>, <User: dopey>, <User: grumpy>]>[source]

The queryset used for the choice.

choice_id = 'reviewer'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Reviewer'[source]

The displayed name for the choice.

operators = <djblets.conditions.operators.ConditionOperators object>[source]

The operators for this choice.

This must be set to an instance of ConditionOperators.

get_match_value(review_request, **kwargs)[source]

Return the reviewers used for matching.

Parameters
Returns

List of the review request’s reviewers.

Return type

list of django.contrib.auth.models.User

__annotations__ = {}
class ReviewRequestParticipantChoice(**kwargs)[source]

Bases: reviewboard.site.conditions.LocalSiteModelChoiceMixin, reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, djblets.conditions.choices.BaseConditionModelMultipleChoice

A condition choice for matching a review request’s participant.

queryset = <QuerySet [<User: admin>, <User: doc>, <User: dopey>, <User: grumpy>]>[source]

The queryset used for the choice.

choice_id = 'participant'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Participant'[source]

The displayed name for the choice.

operators = <djblets.conditions.operators.ConditionOperators object>[source]

The operators for this choice.

This must be set to an instance of ConditionOperators.

get_match_value(review_request, **kwargs)[source]

Return the participants used for matching.

Parameters
Returns

The review request’s participants.

Return type

set of django.contrib.auth.models.User

__annotations__ = {}
class ReviewRequestSummaryChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, djblets.conditions.choices.BaseConditionStringChoice

A condition choice for matching a review request’s summary.

choice_id = 'summary'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Summary'[source]

The displayed name for the choice.

get_match_value(review_request, **kwargs)[source]

Return the summary text used for matching.

Parameters
Returns

The review request’s summary text.

Return type

unicode

__annotations__ = {}
class ReviewRequestTestingDoneChoice(**kwargs)[source]

Bases: djblets.conditions.choices.BaseConditionStringChoice

A condition choice for matching a review request’s Testing Done field.

choice_id = 'testing-done'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Testing Done'[source]

The displayed name for the choice.

get_match_value(review_request, **kwargs)[source]

Return the testing done text used for matching.

Parameters
Returns

The review request’s testing done text.

Return type

unicode

__annotations__ = {}
class ReviewRequestRepositoriesChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, reviewboard.scmtools.conditions.RepositoriesChoice

A condition choice for matching a review request’s repositories.

get_match_value(review_request, **kwargs)[source]

Return the repository used for matching.

Parameters
Returns

The review request’s repository.

Return type

reviewboard.scmtools.models.Repository

__annotations__ = {}
class ReviewRequestRepositoryTypeChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, reviewboard.scmtools.conditions.RepositoryTypeChoice

A condition choice for matching a review request’s repository types.

get_match_value(review_request, **kwargs)[source]

Return the repository used for matching.

Parameters
Returns

The review request’s repository.

Return type

reviewboard.scmtools.models.Repository

__annotations__ = {}
class ReviewRequestReviewGroupsChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.ReviewRequestConditionChoiceMixin, reviewboard.reviews.conditions.ReviewGroupsChoice

A condition choice for matching a review request’s review groups.

get_match_value(review_request, **kwargs)[source]

Return the review groups used for matching.

Parameters
Returns

The queryset for a review request’s target review groups.

Return type

django.db.models.query.QuerySet

__annotations__ = {}
class ReviewRequestConditionChoices(choices=[])[source]

Bases: djblets.conditions.choices.ConditionChoices

A standard set of review request condition choices.

This provides a handful of condition choices that are useful for review requests. They can be used in integrations or any other place where conditions are used.

choice_classes = [<class 'reviewboard.reviews.conditions.ReviewRequestBranchChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestDescriptionChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestRepositoriesChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestRepositoryTypeChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestReviewGroupsChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestOwnerChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestReviewerChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestParticipantChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestSummaryChoice'>, <class 'reviewboard.reviews.conditions.ReviewRequestTestingDoneChoice'>][source]

A list of default choices.

This is only used if a list of choices is not passed to the constructor.

__annotations__ = {}