Exemplo n.º 1
0
    def clean(self):
        """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.
        """
        if not self.errors and self.subforms_valid:
            try:
                self.local_site = self.cleaned_data['local_site']

                if self.local_site:
                    self.local_site_name = self.local_site.name
            except LocalSite.DoesNotExist, e:
                raise forms.ValidationError([e])

            self._clean_hosting_info()
            self._clean_bug_tracker_info()

            validate_review_groups(self)
            validate_users(self)

            # The clean/validation functions could create new errors, so
            # skip validating the repository path if everything else isn't
            # clean.
            if (not self.errors and
                not self.cleaned_data['reedit_repository'] and
                self.validate_repository):
                self._verify_repository_path()
Exemplo n.º 2
0
    def clean(self):
        """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.
        """
        if not self.errors and self.subforms_valid:
            try:
                self.local_site = self.cleaned_data['local_site']

                if self.local_site:
                    self.local_site_name = self.local_site.name
            except LocalSite.DoesNotExist, e:
                raise forms.ValidationError([e])

            self._clean_hosting_info()
            self._clean_bug_tracker_info()

            validate_review_groups(self)
            validate_users(self)

            # The clean/validation functions could create new errors, so
            # skip validating the repository path if everything else isn't
            # clean.
            if (not self.errors and not self.cleaned_data['reedit_repository']
                    and self.validate_repository):
                self._verify_repository_path()
Exemplo n.º 3
0
    def clean(self):
        validate_users(self, 'people')
        validate_review_groups(self, 'groups')

        # Now make sure the repositories are valid.
        local_site = self.cleaned_data['local_site']
        repositories = self.cleaned_data['repository']

        for repository in repositories:
            if repository.local_site != local_site:
                raise forms.ValidationError([
                    _("The repository '%s' doesn't exist on the local site.") %
                    repository.name,
                ])

        return self.cleaned_data
Exemplo n.º 4
0
    def clean(self):
        validate_users(self, 'people')
        validate_review_groups(self, 'groups')

        # Now make sure the repositories are valid.
        local_site = self.cleaned_data['local_site']
        repositories = self.cleaned_data['repository']

        for repository in repositories:
            if repository.local_site != local_site:
                raise forms.ValidationError([
                    _("The repository '%s' doesn't exist on the local site.")
                    % repository.name,
                ])

        return self.cleaned_data
Exemplo n.º 5
0
    def clean(self):
        try:
            validate_users(self, 'people')
        except ValidationError as e:
            self._errors['people'] = self.error_class(e.messages)

        try:
            validate_review_groups(self, 'groups')
        except ValidationError as e:
            self._errors['groups'] = self.error_class(e.messages)

        try:
            validate_repositories(self, 'repository')
        except ValidationError as e:
            self._errors['repository'] = self.error_class(e.messages)

        return super(DefaultReviewerForm, self).clean()
Exemplo n.º 6
0
    def clean(self):
        """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.
        """
        if not self.errors and self.subforms_valid:
            try:
                self.local_site = self.cleaned_data["local_site"]

                if self.local_site:
                    self.local_site_name = self.local_site.name
            except LocalSite.DoesNotExist as e:
                raise ValidationError([e])

            self._clean_hosting_info()
            self._clean_bug_tracker_info()

            validate_review_groups(self)
            validate_users(self)

            # The clean/validation functions could create new errors, so
            # skip validating the repository path if everything else isn't
            # clean. Also skip in the case where the user is hiding the
            # repository.
            if (
                not self.errors
                and not self.cleaned_data["reedit_repository"]
                and self.cleaned_data.get("visible", True)
                and self.validate_repository
            ):
                self._verify_repository_path()

            self._clean_ssh_key_association()

        return super(RepositoryForm, self).clean()
Exemplo n.º 7
0
    def clean(self):
        try:
            validate_users(self, "people")
        except ValidationError as e:
            self._errors["people"] = self.error_class(e.messages)

        try:
            validate_review_groups(self, "groups")
        except ValidationError as e:
            self._errors["groups"] = self.error_class(e.messages)

        # Now make sure the repositories are valid.
        local_site = self.cleaned_data["local_site"]
        repositories = self.cleaned_data["repository"]

        for repository in repositories:
            if repository.local_site != local_site:
                self._errors["repository"] = self.error_class(
                    [_("The repository '%s' doesn't exist on the local site.") % repository.name]
                )
                break

        return self.cleaned_data
Exemplo n.º 8
0
    def clean(self):
        """
        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.
        """
        self._clean_hosting_info()
        self._clean_bug_tracker_info()

        validate_review_groups(self)
        validate_users(self)

        if not self.cleaned_data['reedit_repository']:
            self._verify_repository_path()

        return super(RepositoryForm, self).clean()
Exemplo n.º 9
0
    def clean(self):
        try:
            validate_users(self, 'people')
        except ValidationError as e:
            self._errors['people'] = self.error_class(e.messages)

        try:
            validate_review_groups(self, 'groups')
        except ValidationError as e:
            self._errors['groups'] = self.error_class(e.messages)

        # Now make sure the repositories are valid.
        local_site = self.cleaned_data['local_site']
        repositories = self.cleaned_data['repository']

        for repository in repositories:
            if repository.local_site != local_site:
                self._errors['repository'] = self.error_class([
                    _("The repository '%s' doesn't exist on the local site.")
                    % repository.name,
                ])
                break

        return super(DefaultReviewerForm, self).clean()
Exemplo n.º 10
0
    def clean(self):
        try:
            validate_users(self, 'people')
        except ValidationError as e:
            self._errors['people'] = self.error_class(e.messages)

        try:
            validate_review_groups(self, 'groups')
        except ValidationError as e:
            self._errors['groups'] = self.error_class(e.messages)

        # Now make sure the repositories are valid.
        local_site = self.cleaned_data['local_site']
        repositories = self.cleaned_data['repository']

        for repository in repositories:
            if repository.local_site != local_site:
                self._errors['repository'] = self.error_class([
                    _("The repository '%s' doesn't exist on the local site.")
                    % repository.name,
                ])
                break

        return super(DefaultReviewerForm, self).clean()
Exemplo n.º 11
0
    def clean(self):
        """
        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.
        """
        self._clean_hosting_info()
        self._clean_bug_tracker_info()

        validate_review_groups(self)
        validate_users(self)

        if not self.cleaned_data['reedit_repository']:
            self._verify_repository_path()

        return super(RepositoryForm, self).clean()
Exemplo n.º 12
0
    def clean(self):
        validate_users(self)

        return self.cleaned_data
Exemplo n.º 13
0
    def clean(self):
        validate_users(self)

        return self.cleaned_data
Exemplo n.º 14
0
    def clean(self):
        validate_users(self)

        return super(GroupForm, self).clean()
Exemplo n.º 15
0
    def clean(self):
        validate_users(self)

        return super(GroupForm, self).clean()
Exemplo n.º 16
0
 def clean(self):
     try:
         validate_users(self, 'people')
     except forms.ValidationError, e:
         self._errors['people'] = self.error_class(e.messages)