Jump to >

reviewboard.integrations.models

Database models for integration configuration storage.

class IntegrationConfig(*args, **kwargs)[source]

Bases: reviewboard.integrations.base.GetIntegrationManagerMixin, djblets.integrations.models.BaseIntegrationConfig

Stored configuration for a particular integration.

This contains configuration settings for a given instance of an integration, along with state indicating if that integration is to be enabled and user-specified identifying information.

local_site[source]
load_conditions(form_cls, conditions_key=u'conditions')[source]

Load a set of conditions from the configuration.

This loads and deserializes a set of conditions from the configuration stored in the provided key. Those conditions can then be matched by the caller.

If the conditions are not found, this will return None.

If the conditions cannot be deserialized, this will log some diagnostic output and error messages and return None.

Parameters:
  • form_cls (type) –

    The configuration form class that owns the condition field.

    This will generally be my_integration.form_cls, but can be another form in more complex integrations.

  • conditions_key (unicode, optional) – The key for the conditions data in the configuration. Defaults to “conditions”.
Returns:

The condition set based on the data, if found and if it could be loaded. Otherwise, None will be returned.

Return type:

djblets.conditions.conditions.ConditionSet

match_conditions(form_cls, conditions_key=u'conditions', **match_kwargs)[source]

Filter configurations based on a review request.

If the configuration contains a conditions key, and the configuration form contains a matching field, this will check the conditions for matches against the review request.

Parameters:
  • form_cls (type) –

    The configuration form class that owns the condition field.

    This will generally be my_integration.form_cls, but can be another form in more complex integrations.

  • conditions_key (unicode, optional) – The key for the conditions data in the configuration. Defaults to “conditions”.
  • **match_kwargs (dict) – Keyword arguments to match for the conditions.
Returns:

True if the specified conditions in the configuration matches the provided keyword arguments. False if not.

Return type:

bool

get_extra_data_json()[source]
get_next_by_last_updated(**morekwargs)[source]
get_next_by_time_added(**morekwargs)[source]
get_previous_by_last_updated(**morekwargs)[source]
get_previous_by_time_added(**morekwargs)[source]
get_settings_json()[source]
objects = <django.db.models.manager.Manager object>[source]
set_extra_data_json(json)[source]
set_settings_json(json)[source]