示例#1
0
class IrcForm(FlaskForm):
    ''' Form to configure the irc hook. '''
    server = wtforms.TextField(
        'Server <span class="error">*</span>',
        [RequiredIf('active')]
    )
    port = wtforms.TextField(
        'Port <span class="error">*</span>',
        [RequiredIf('active')]
    )
    room = wtforms.TextField(
        'Room <span class="error">*</span>',
        [RequiredIf('active')]
    )
    nick = wtforms.TextField(
        'Nick',
        [wtforms.validators.Optional()]
    )
    nick_pass = wtforms.TextField(
        'Nickserv Password',
        [wtforms.validators.Optional()]
    )

    active = wtforms.BooleanField(
        'Active',
        [wtforms.validators.Optional()]
    )
    join = wtforms.BooleanField(
        'Message Without Join',
        [wtforms.validators.Optional()]
    )
    ssl = wtforms.BooleanField(
        'Use SSL',
        [wtforms.validators.Optional()]
    )
示例#2
0
class PagureCiForm(FlaskForm):
    """ Form to configure the CI hook. """

    ci_type = wtforms.SelectField(
        "Type of CI service",
        [RequiredIf(["active_commit", "active_pr"])],
        choices=[],
    )

    ci_url = wtforms.StringField(
        "URL to the project on the CI service",
        [
            RequiredIf(["active_commit", "active_pr"]),
            wtforms.validators.Length(max=255),
        ],
    )

    ci_username = wtforms.StringField(
        "Username to authenticate with if needed",
        [wtforms.validators.Optional(),
         wtforms.validators.Length(max=255)],
    )

    ci_password = wtforms.StringField(
        "Password to authenticate with if needed",
        [wtforms.validators.Optional(),
         wtforms.validators.Length(max=255)],
    )

    ci_job = wtforms.StringField(
        "Name of the job to trigger",
        [
            RequiredIf(["active_commit", "active_pr"]),
            wtforms.validators.Length(max=255),
        ],
    )

    # The active field is not render in the UI it used
    # to hold the result of a logical OR between active_pr
    # and active_commit.
    # The value of active is set in pagure.ui.plugins.view_plugin
    active = wtforms.BooleanField("Activate Pagure CI service",
                                  [wtforms.validators.Optional()])

    active_commit = wtforms.BooleanField("Trigger CI job on commits",
                                         [wtforms.validators.Optional()])

    active_pr = wtforms.BooleanField("Trigger CI job on pull-requests",
                                     [wtforms.validators.Optional()])

    def __init__(self, *args, **kwargs):
        """ Calls the default constructor with the normal argument but
        uses the list of collection provided to fill the choices of the
        drop-down list.
        """
        super(PagureCiForm, self).__init__(*args, **kwargs)

        types = pagure.config.config.get("PAGURE_CI_SERVICES", [])
        self.ci_type.choices = [(ci_type, ci_type) for ci_type in types]
示例#3
0
class IrcForm(FlaskForm):
    """ Form to configure the irc hook. """

    server = wtforms.StringField('Server <span class="error">*</span>',
                                 [RequiredIf("active")])
    port = wtforms.StringField('Port <span class="error">*</span>',
                               [RequiredIf("active")])
    room = wtforms.StringField('Room <span class="error">*</span>',
                               [RequiredIf("active")])
    nick = wtforms.StringField("Nick", [wtforms.validators.Optional()])
    nick_pass = wtforms.StringField("Nickserv Password",
                                    [wtforms.validators.Optional()])

    active = wtforms.BooleanField("Active", [wtforms.validators.Optional()])
    join = wtforms.BooleanField("Message Without Join",
                                [wtforms.validators.Optional()])
    ssl = wtforms.BooleanField("Use SSL", [wtforms.validators.Optional()])
示例#4
0
class RtdForm(wtf.Form):
    ''' Form to configure the pagure hook. '''
    project_name = wtforms.TextField('Project name on readthedoc.org',
                                     [RequiredIf('active')])
    branches = wtforms.TextField(
        'Restrict build to these branches only (comma separated)',
        [wtforms.validators.Optional()])

    active = wtforms.BooleanField('Active', [wtforms.validators.Optional()])
示例#5
0
class PagureCiForm(FlaskForm):
    ''' Form to configure the CI hook. '''
    ci_type = wtforms.SelectField('Type of CI service', [RequiredIf('active')],
                                  choices=[])

    ci_url = wtforms.TextField(
        'URL to the project on the CI service',
        [
            RequiredIf(['active_commit', 'active_pr']),
            wtforms.validators.Length(max=255)
        ],
    )

    ci_job = wtforms.TextField(
        'Name of the job to trigger',
        [
            RequiredIf(['active_commit', 'active_pr']),
            wtforms.validators.Length(max=255)
        ],
    )

    # The active field is not render in the UI it used
    # to hold the result of a logical OR between active_pr
    # and active_commit.
    # The value of active is set in pagure.ui.plugins.view_plugin
    active = wtforms.BooleanField('Activate Pagure CI service',
                                  [wtforms.validators.Optional()])

    active_commit = wtforms.BooleanField('Trigger CI job on commits',
                                         [wtforms.validators.Optional()])

    active_pr = wtforms.BooleanField('Trigger CI job on pull-requests',
                                     [wtforms.validators.Optional()])

    def __init__(self, *args, **kwargs):
        """ Calls the default constructor with the normal argument but
        uses the list of collection provided to fill the choices of the
        drop-down list.
        """
        super(PagureCiForm, self).__init__(*args, **kwargs)

        types = pagure.config.config.get('PAGURE_CI_SERVICES', [])
        self.ci_type.choices = [(ci_type, ci_type) for ci_type in types]
示例#6
0
class MailForm(wtf.Form):
    ''' Form to configure the mail hook. '''
    mail_to = wtforms.TextField(
        'Mail to',
        [RequiredIf('active')]
    )
    active = wtforms.BooleanField(
        'Active',
        [wtforms.validators.Optional()]
    )
class PagureForceCommitForm(FlaskForm):
    ''' Form to configure the pagure hook. '''
    branches = wtforms.TextField(
        'Branches',
        [RequiredIf('active')]
    )

    active = wtforms.BooleanField(
        'Active',
        [wtforms.validators.Optional()]
    )
示例#8
0
class PagureCiForm(FlaskForm):
    ''' Form to configure the CI hook. '''
    ci_type = wtforms.SelectField('Type of CI service', [RequiredIf('active')],
                                  choices=[])
    ci_url = wtforms.TextField(
        'URL to the project on the CI service',
        [RequiredIf('active'),
         wtforms.validators.Length(max=255)],
    )
    active = wtforms.BooleanField('Active', [wtforms.validators.Optional()])

    def __init__(self, *args, **kwargs):
        """ Calls the default constructor with the normal argument but
        uses the list of collection provided to fill the choices of the
        drop-down list.
        """
        super(PagureCiForm, self).__init__(*args, **kwargs)

        types = APP.config.get('PAGURE_CI_SERVICES', [])
        self.ci_type.choices = [(ci_type, ci_type) for ci_type in types]
示例#9
0
class MirrorForm(FlaskForm):
    """ Form to configure the mirror hook. """

    active = wtforms.BooleanField("Active", [wtforms.validators.Optional()])

    target = wtforms.StringField(
        "Git repo to mirror to",
        [RequiredIf("active"),
         CustomRegexp(ssh_urlpattern, optional=True)],
    )

    public_key = wtforms.TextAreaField("Public SSH key",
                                       [wtforms.validators.Optional()])
    last_log = wtforms.TextAreaField("Log of the last sync:",
                                     [wtforms.validators.Optional()])
示例#10
0
class MailForm(FlaskForm):
    """ Form to configure the mail hook. """

    mail_to = wtforms.StringField("Mail to", [RequiredIf("active")])
    active = wtforms.BooleanField("Active", [wtforms.validators.Optional()])
示例#11
0
class PagureForceCommitForm(FlaskForm):
    """ Form to configure the pagure hook. """

    branches = wtforms.StringField("Branches", [RequiredIf("active")])

    active = wtforms.BooleanField("Active", [wtforms.validators.Optional()])