Jump to >

reviewboard.scmtools.forms

class HostingAccountWidget(attrs=None, choices=())[source]

Bases: django.forms.widgets.Select

A widget for selecting and modifying an assigned hosting account.

This presents a list of available hosting service accounts as a drop-down, and provides a link for editing the credentials of the selected account.

render(*args, **kwargs)[source]

Render the widget.

Parameters:
  • *args (tuple) – Arguments for the render.
  • **kwargs (dict) – Keyword arguments for the render.
Returns:

The HTML for the widget.

Return type:

django.utils.safestring.SafeText

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

Bases: django.forms.models.ModelForm

A form for creating and updating repositories.

This form provides an interface for creating and updating repositories, handling the association with hosting services, linking accounts, dealing with SSH keys and SSL certificates, and more.

REPOSITORY_HOSTING_FIELDSET = _(u’Repository Hosting’)[source]
REPOSITORY_INFO_FIELDSET = _(u’Repository Information’)[source]
BUG_TRACKER_FIELDSET = _(u’Bug Tracker’)[source]
SSH_KEY_FIELDSET = _(u’Review Board Server SSH Key’)[source]
NO_HOSTING_SERVICE_ID = u’custom’[source]
NO_HOSTING_SERVICE_NAME = _(u’(None - Custom Repository)’)[source]
NO_BUG_TRACKER_ID = u’none’[source]
NO_BUG_TRACKER_NAME = _(u’(None)’)[source]
CUSTOM_BUG_TRACKER_ID = u’custom’[source]
CUSTOM_BUG_TRACKER_NAME = _(u’(Custom Bug Tracker)’)[source]
IGNORED_SERVICE_IDS = (u’none’, u’custom’)[source]
DEFAULT_PLAN_ID = u’default’[source]
DEFAULT_PLAN_NAME = _(u’Default’)[source]
NO_KEY_HELP_FMT = _(u’This repository type supports SSH key association, but the Review Board server does not have an SSH key. <a href=”%s”>Add an SSH key.</a>’)[source]
__init__(*args, **kwargs)[source]
full_clean(*args, **kwargs)[source]
clean()[source]

Performs validation on the form.

This will check the form fields for errors, calling out to the various clean_* methods.

It will check the repository path to see if it represents a valid repository and if an SSH key or HTTPS certificate needs to be verified.

This will also build repository and bug tracker URLs based on other fields set in the form.

clean_path()[source]
clean_mirror_path()[source]
clean_password()[source]
clean_bug_tracker_base_url()[source]
clean_bug_tracker_hosting_url()[source]

Validates that the bug tracker hosting url is valid.

Note that bug tracker hosting url is whatever the bug hosting form (e.g BugzillaForm) specifies.

cleaned_data[‘bug_tracker_hosting_url’] refers to a specific field in bug tracker description that only GitLab uses, and has quite a misleading name. It will not contain the base URL of the bug tracker in other cases.

clean_hosting_type()[source]

Validates that the hosting type represents a valid hosting service.

This won’t do anything if no hosting service is used.

clean_bug_tracker_type()[source]

Validates that the bug tracker type represents a valid hosting service.

This won’t do anything if no hosting service is used.

clean_tool()[source]

Checks the SCMTool used for this repository for dependencies.

If one or more dependencies aren’t found, they will be presented as validation errors.

declared_fields = {‘reedit_repository’: <django.forms.fields.BooleanField object>, ‘trust_host’: <django.forms.fields.BooleanField object>, ‘hosting_type’: <django.forms.fields.ChoiceField object>, ‘hosting_account’: <django.forms.models.ModelChoiceField object>, ‘force_authorize’: <django.forms.fields.BooleanField object>, ‘tool’: <django.forms.fields.ChoiceField object>, ‘repository_plan’: <django.forms.fields.ChoiceField object>, ‘password’: <django.forms.fields.CharField object>, ‘associate_ssh_key’: <django.forms.fields.BooleanField object>, ‘bug_tracker_use_hosting’: <django.forms.fields.BooleanField object>, ‘bug_tracker_type’: <django.forms.fields.ChoiceField object>, ‘bug_tracker_hosting_url’: <django.forms.fields.CharField object>, ‘bug_tracker_plan’: <django.forms.fields.ChoiceField object>, ‘bug_tracker_hosting_account_username’: <django.forms.fields.CharField object>, ‘bug_tracker’: <django.forms.fields.CharField object>, ‘use_ticket_auth’: <django.forms.fields.BooleanField object>, ‘users’: <django.forms.models.ModelMultipleChoiceField object>}[source]
is_valid()[source]

Returns whether or not the form is valid.

This will return True if the form fields are all valid, if there’s no certificate error, host key error, and if the form isn’t being re-displayed after canceling an SSH key or HTTPS certificate verification.

This also takes into account the validity of the hosting service form for the selected hosting service and repository plan.

save(commit=True, *args, **kwargs)[source]

Saves the repository.

This will thunk out to the hosting service form to save any extra repository data used for the hosting service, and saves the repository plan, if any.

class Meta[source]
model[source]

alias of Repository

widgets = {u’username’: <django.forms.widgets.TextInput object>, u’name’: <django.forms.widgets.TextInput object>, u’review_groups’: <django.contrib.admin.widgets.FilteredSelectMultiple object>, u’mirror_path’: <django.forms.widgets.TextInput object>, u’raw_file_url’: <django.forms.widgets.TextInput object>, u’bug_tracker’: <django.forms.widgets.TextInput object>, u’path’: <django.forms.widgets.TextInput object>}[source]