Jump to >

This documentation covers the in-development release of Review Board. You can see the latest stable docs or all previous versions.

reviewboard.scmtools.conditions

Condition choices and operators for repositories and SCMTools.

class RepositoryConditionChoiceMixin[source]

Bases: object

Mixin for condition choices that operate off repositories.

This will set state needed to match against the choice.

value_kwarg = 'repository'[source]
__annotations__ = {}
class IsRepositoryPrivateOperator(choice)[source]

Bases: djblets.conditions.operators.BaseConditionOperator

An operator for matching private repositories.

operator_id = 'is-private'[source]

The ID of the operator.

This must be unique within a BaseConditionChoice.

name = 'Is private'[source]

The displayed name for the operator.

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

Return whether the repository is private.

Parameters
Returns

True if the repository is private. False if public.

Return type

bool

__annotations__ = {}
class IsRepositoryPublicOperator(choice)[source]

Bases: djblets.conditions.operators.BaseConditionOperator

An operator for matching public repositories.

operator_id = 'is-public'[source]

The ID of the operator.

This must be unique within a BaseConditionChoice.

name = 'Is public'[source]

The displayed name for the operator.

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

Return whether the repository is public.

Parameters
Returns

True if the repository is public. False if private.

Return type

bool

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

Bases: reviewboard.scmtools.conditions.RepositoryConditionChoiceMixin, djblets.conditions.choices.BaseConditionModelMultipleChoice

A condition choice for matching repositories.

This is used to match a Repository against a list of repositories, against no repository (None), or against a repository public/private state.

choice_id = 'repository'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Repository'[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_queryset()[source]

Return the queryset used to look up repository choices.

Returns

The queryset for repositories.

Return type

django.db.models.query.QuerySet

get_match_value(repository, **kwargs)[source]

Return the value used for matching.

This will return the provided repository directly.

Parameters
Returns

The provided repository.

Return type

reviewboard.scmtools.models.Repository

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

Bases: reviewboard.scmtools.conditions.RepositoryConditionChoiceMixin, djblets.conditions.choices.BaseConditionChoice

A condition choice for matching repository types.

This is used to match a Repository of a certain type (based on the Tool).

choice_id = 'repository_type'[source]

The ID of the choice.

This must be unique within a ConditionSet.

name = 'Repository type'[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.

default_value_field(**kwargs)[source]

Return the default value field for this choice.

This will call out to get_queryset() before returning the field, allowing subclasses to simply set queryset or to perform more dynamic queries before constructing the form field.

Parameters

**kwargs (dict) – Extra keyword arguments for this function, for future expansion.

Returns

The form field for the value.

Return type

djblets.conditions.values.ConditionValueMultipleModelField

get_match_value(repository, **kwargs)[source]

Return the value used for matching.

This will return the SCMTool ID for the provided repository.

Parameters
Returns

The SCMTool ID for the repository’s tool.

Return type

str

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

Bases: djblets.conditions.choices.ConditionChoices

A standard set of repository condition choices.

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

choice_classes = [<class 'reviewboard.scmtools.conditions.RepositoriesChoice'>, <class 'reviewboard.scmtools.conditions.RepositoryTypeChoice'>][source]

A list of default choices.

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

__annotations__ = {}