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 = u'review_request'[source]
class AnyReviewGroupsPublicOperator(choice)[source]

Bases: djblets.conditions.operators.BaseConditionOperator

An operator for matching against any public review groups.

operator_id = u'any-public'[source]
name = u'Are any public'[source]
value_field = None[source]
matches(match_value, **kwargs)[source]

Return whether any review groups are public.

Parameters:
  • match_value (list of reviewboard.reviews.models.group.Group) – The review groups to match.
  • **kwargs (dict) – Unused keyword arguments.
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 = u'all-invite-only'[source]
name = u'Are all invite-only'[source]
value_field = None[source]
matches(match_value, **kwargs)[source]

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

Parameters:
  • match_value (list of reviewboard.reviews.models.group.Group) – The review groups to match.
  • **kwargs (dict) – Unused keyword arguments.
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

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 = u'review-groups'[source]
name = u'Review groups'[source]
value_kwarg = u'review_groups'[source]
operators = <djblets.conditions.operators.ConditionOperators object>[source]
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 = u'branch'[source]
name = u'Branch'[source]
get_match_value(review_request, **kwargs)[source]

Return the branch text used for matching.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Unused keyword arguments.
Returns:

The review request’s branch text.

Return type:

unicode

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 = u'description'[source]
name = u'Description'[source]
get_match_value(review_request, **kwargs)[source]

Return the description text used for matching.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Unused keyword arguments.
Returns:

The review request’s description text.

Return type:

unicode

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:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Unused keyword arguments.
Returns:

The set of filenames.

Return type:

set of unicode

class ReviewRequestAnyDiffFileChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.BaseReviewRequestDiffFileChoice

choice_id = u'any_diffed_file'[source]
name = u'Any diffed file'[source]
require_match_all_items = False[source]
class ReviewRequestAllDiffFilesChoice(**kwargs)[source]

Bases: reviewboard.reviews.conditions.BaseReviewRequestDiffFileChoice

choice_id = u'all_diffed_files'[source]
name = u'All diffed file'[source]
require_match_all_items = True[source]
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]
choice_id = u'owner'[source]
name = u'Owner'[source]
operators = <djblets.conditions.operators.ConditionOperators object>[source]
get_match_value(review_request, **kwargs)[source]

Return the owner used for matching.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Unused keyword arguments.
Returns:

The review request’s owner.

Return type:

django.contrib.auth.models.User

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]
choice_id = u'reviewer'[source]
name = u'Reviewer'[source]
operators = <djblets.conditions.operators.ConditionOperators object>[source]
get_match_value(review_request, **kwargs)[source]

Return the reviewers used for matching.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict, unused) – Unused keyword arguments.
Returns:

List of the review request’s reviewers.

Return type:

list of django.contrib.auth.models.User

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]
choice_id = u'participant'[source]
name = u'Participant'[source]
operators = <djblets.conditions.operators.ConditionOperators object>[source]
get_match_value(review_request, **kwargs)[source]

Return the participants used for matching.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict, unused) – Unused keyword arguments.
Returns:

The review request’s participants.

Return type:

set of django.contrib.auth.models.User

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 = u'summary'[source]
name = u'Summary'[source]
get_match_value(review_request, **kwargs)[source]

Return the summary text used for matching.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Unused keyword arguments.
Returns:

The review request’s summary text.

Return type:

unicode

class ReviewRequestTestingDoneChoice(**kwargs)[source]

Bases: djblets.conditions.choices.BaseConditionStringChoice

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

choice_id = u'testing-done'[source]
name = u'Testing Done'[source]
get_match_value(review_request, **kwargs)[source]

Return the testing done text used for matching.

Parameters:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Unused keyword arguments.
Returns:

The review request’s testing done text.

Return type:

unicode

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:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Unused keyword arguments.
Returns:

The review request’s repository.

Return type:

reviewboard.scmtools.models.Repository

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:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Unused keyword arguments.
Returns:

The review request’s repository.

Return type:

reviewboard.scmtools.models.Repository

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:
  • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The provided review request.
  • **kwargs (dict) – Extra keyword arguments.
Returns:

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

Return type:

django.db.models.query.QuerySet

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]