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: reviewboard.site.mixins.LocalSiteAwareModelFormMixin, 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]
local_site_name[source]

The name of the current Local Site for this form.

This will be None if no Local Site is assigned.

get_repository_already_exists()[source]

Return whether a repository with these details already exists.

This will validate the form before returning a result. Callers are encouraged to call is_valid() themselves before calling this.

Returns:True if a repository already exists with this name or path. False if one does not exist.
Return type:bool
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.

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 reviewboard.scmtools.models.Repository

widgets = {u'bug_tracker': <django.forms.widgets.TextInput object at 0x10b333ad0>, u'mirror_path': <django.forms.widgets.TextInput object at 0x10b333a90>, u'name': <django.forms.widgets.TextInput object at 0x10b333bd0>, u'path': <django.forms.widgets.TextInput object at 0x10b333a50>, u'raw_file_url': <django.forms.widgets.TextInput object at 0x10b333b10>, u'review_groups': <django.contrib.admin.widgets.FilteredSelectMultiple object at 0x10b333c90>, u'username': <django.forms.widgets.TextInput object at 0x10b333c10>}[source]
fields = u'__all__'[source]
declared_fields = {'associate_ssh_key': <django.forms.fields.BooleanField object at 0x10b327ed0>, 'bug_tracker': <django.forms.fields.CharField object at 0x10b333610>, 'bug_tracker_hosting_account_username': <django.forms.fields.CharField object at 0x10b333550>, 'bug_tracker_hosting_url': <django.forms.fields.CharField object at 0x10b333350>, 'bug_tracker_plan': <django.forms.fields.ChoiceField object at 0x10b3333d0>, 'bug_tracker_type': <django.forms.fields.ChoiceField object at 0x10b333190>, 'bug_tracker_use_hosting': <django.forms.fields.BooleanField object at 0x10b333050>, 'force_authorize': <django.forms.fields.BooleanField object at 0x10b327a10>, 'hosting_account': <django.forms.models.ModelChoiceField object at 0x10b3278d0>, 'hosting_type': <django.forms.fields.ChoiceField object at 0x10b3275d0>, 'password': <django.forms.fields.CharField object at 0x10b327e10>, 'reedit_repository': <django.forms.fields.BooleanField object at 0x10b327450>, 'repository_plan': <django.forms.fields.ChoiceField object at 0x10b327c90>, 'tool': <django.forms.fields.ChoiceField object at 0x10b327a50>, 'trust_host': <django.forms.fields.BooleanField object at 0x10b327510>, 'use_ticket_auth': <django.forms.fields.BooleanField object at 0x10b3337d0>, 'users': <django.forms.models.ModelMultipleChoiceField object at 0x10b3338d0>}[source]