Exemplo n.º 1
0
class UserRegisterForm(wtf.Form):
    username = wtf.TextField(
        'Username',
        validators=[
            wtf.Required(),
            wtf.Length(min=2, max=50),
            wtf.Regexp(
                '^[a-zA-Z0-9_]*$',
                message=
                ('Username must only contain a to z, 0 to 9, and underscores.'
                 ))
        ],
        description=(
            'Your username is public and used as part of your project name.'))
    email = wtf.TextField('Email',
                          validators=[wtf.Required(),
                                      wtf.validators.Email()])
    password = wtf.PasswordField('Password',
                                 validators=[
                                     wtf.Required(),
                                     wtf.Length(5),
                                     wtf.EqualTo('confirm',
                                                 'Passwords do not match.'),
                                 ])
    confirm = wtf.PasswordField('Confirm Password')

    def validate_username(form, field):
        from notifico.views.account import _reserved

        username = field.data.strip().lower()
        if username in _reserved or User.username_exists(username):
            raise wtf.ValidationError('Sorry, but that username is taken.')
Exemplo n.º 2
0
class ChannelDetailsForm(wtf.Form):
    channel = wtf.TextField(
        'Channel', validators=[wtf.Required(),
                               wtf.Length(min=1, max=80)])
    host = wtf.TextField(
        'Host',
        validators=[wtf.Required(), wtf.Length(min=1, max=255)],
        default='chat.freenode.net')
    port = wtf.IntegerField('Port',
                            validators=[wtf.NumberRange(1024, 66552)],
                            default=6667)
    ssl = wtf.BooleanField('Use SSL', default=False)
    public = wtf.BooleanField(
        'Public',
        default=True,
        description=('Allow others to see that this channel exists.'))
Exemplo n.º 3
0
class PostForm(Form):
    title = wtf.TextField(u"Title",
                          validators=[wtf.Required(),
                                      wtf.Length(max=250)])
    url = wtf.html5.URLField(
        u"URL", validators=[wtf.Optional(),
                            wtf.url(),
                            wtf.Length(max=2048)])
    description = wtf.TextAreaField(
        u"Description", description=u"Accepts Markdown formatting.")

    def validate_description(self, field):
        if not field.data:
            if not self.url.data:
                raise wtf.ValidationError(
                    "Either a URL or a description must be provided.")
Exemplo n.º 4
0
class BitbucketConfigForm(wtf.Form):
    branches = wtf.TextField(
        'Branches',
        validators=[wtf.Optional(), wtf.Length(max=1024)],
        description=(
            'A comma-seperated list of branches to forward, or blank for all.'
            ' Ex: "master, dev"'))
    use_colors = wtf.BooleanField(
        'Use Colors',
        validators=[wtf.Optional()],
        default=True,
        description=(
            'If checked, commit messages will include minor mIRC coloring.'))
    show_branch = wtf.BooleanField(
        'Show Branch Names',
        validators=[wtf.Optional()],
        default=True,
        description=('If checked, show the branch for a commit.'))
    show_raw_author = wtf.BooleanField(
        'Show Raw Author',
        validators=[wtf.Optional()],
        default=False,
        description=(
            'If checked, shows the raw author for a commit. For example,'
            ' <code>Tyler Kennedy &lt;[email protected]&gt;</code> instead of'
            ' <code>TkTech</code>.'))
Exemplo n.º 5
0
class UserPasswordForm(wtf.Form):
    password = wtf.PasswordField('Password',
                                 validators=[
                                     wtf.Required(),
                                     wtf.Length(5),
                                     wtf.EqualTo('confirm',
                                                 'Passwords do not match.'),
                                 ])
    confirm = wtf.PasswordField('Confirm Password')
Exemplo n.º 6
0
class ProjectDetailsForm(wtf.Form):
    name = wtf.TextField(
        'Project Name',
        validators=[
            wtf.Required(),
            wtf.Length(1, 50),
            wtf.Regexp(
                r'^[a-zA-Z0-9_\-\.]*$',
                message=(
                    'Project name must only contain a to z, 0 to 9, dashes'
                    ' and underscores.'))
        ])
    public = wtf.BooleanField('Public', validators=[], default=True)
    website = wtf.TextField('Project URL',
                            validators=[
                                wtf.Optional(),
                                wtf.Length(max=1024),
                                wtf.validators.URL()
                            ])
Exemplo n.º 7
0
class UserDeleteForm(wtf.Form):
    password = wtf.PasswordField('Password',
                                 validators=[
                                     wtf.Required(),
                                     wtf.Length(5),
                                     wtf.EqualTo('confirm',
                                                 'Passwords do not match.'),
                                 ])
    confirm = wtf.PasswordField('Confirm Password')

    def validate_password(form, field):
        if not User.login(g.user.username, field.data):
            raise wtf.ValidationError('Password is incorrect.')
Exemplo n.º 8
0
class TravisConfigForm(wtf.Form):
    gh_user = wtf.TextField(
        'GitHub username',
        validators=[wtf.Required(), wtf.Length(max=40)],
        description=('Case-sensitive GitHub username of repository owner.'))
    repo_name = wtf.TextField(
        'Repo name',
        validators=[wtf.Required(), wtf.Length(max=100)],
        description=('Case-sensitive name of repository.'))
    token = wtf.TextField(
        'Travis Token',
        validators=[wtf.Required(), wtf.Length(max=1024)],
        description=
        ('Used to authenticate incoming webhooks.<br>'
         'Can be found on your '
         '<a href="https://travis-ci.org/profile/">Travis CI profile page</a>.'
         ))
    use_colors = wtf.BooleanField(
        'Use Colors',
        validators=[wtf.Optional()],
        default=True,
        description=(
            'If checked, commit messages will include minor mIRC coloring.'))
Exemplo n.º 9
0
class GitlabConfigForm(wtf.Form):
    branches = wtf.TextField(
        'Branches',
        validators=[wtf.Optional(), wtf.Length(max=1024)],
        description=(
            'A comma-separated of branches to forward, or blank for all.'
            ' Ex: "master, dev"'))
    events = EventSelectField(
        'Events',
        choices=[('commit_comment', 'Commit comment'),
                 ('snippet_comment', 'Snippet comment'),
                 ('pipeline_created', 'Pipeline status: created'),
                 ('pipeline_pending', 'Pipeline status: pending'),
                 ('pipeline_running', 'Pipeline status: running'),
                 ('pipeline_failed', 'Pipeline status: failed'),
                 ('pipeline_success', 'Pipeline status: success'),
                 ('pipeline_canceled', 'Pipeline status: canceled'),
                 ('pipeline_skipped', 'Pipeline status: skipped'),
                 ('build_created', 'Build status: created'),
                 ('build_pending', 'Build status: pending'),
                 ('build_running', 'Build status: running'),
                 ('build_failed', 'Build status: failed'),
                 ('build_success', 'Build status: success'),
                 ('build_canceled', 'Build status: canceled'),
                 ('build_skipped', 'Build status: skipped'),
                 ('create_branch', 'Create branch'),
                 ('create_tag', 'Create tag'),
                 ('delete_branch', 'Delete branch'),
                 ('delete_tag', 'Delete tag'),
                 ('issue_comment', 'Issue comment'),
                 ('issue_close', 'Issue: closed'),
                 ('issue_update', 'Issue: updated'),
                 ('issue_open', 'Issue: opened'),
                 ('issue_reopen', 'Issue: reopened'),
                 ('mr_comment', 'Merge request comment'),
                 ('mr_close', 'Merge request: closed'),
                 ('mr_update', 'Merge request: updated'),
                 ('mr_open', 'Merge request: opened'),
                 ('mr_reopen', 'Merge request: reopened'),
                 ('mr_merge', 'Merge request: merged'), ('push', 'Push'),
                 ('wiki_create', 'Wiki: created page'),
                 ('wiki_edit', 'Wiki: edited page')])
    use_colors = wtf.BooleanField(
        'Use Colors',
        validators=[wtf.Optional()],
        default=True,
        description=(
            'If checked, commit messages will include minor mIRC coloring.'))
    show_branch = wtf.BooleanField(
        'Show Branch Name',
        validators=[wtf.Optional()],
        default=True,
        description=(
            'If checked, commit messages will include the branch name.'))
    show_tags = wtf.BooleanField(
        'Show Tags',
        validators=[wtf.Optional()],
        default=True,
        description=('If checked, changes to tags will be shown.'))
    full_project_name = wtf.BooleanField(
        'Full Project Name',
        validators=[wtf.Optional()],
        default=False,
        description=
        ('If checked, show the full gitlab project name (ex: tktech/notifico)'
         ' instead of the Notifico project name (ex: notifico)'))
    title_only = wtf.BooleanField(
        'Title Only',
        validators=[wtf.Optional()],
        default=False,
        description=(
            'If checked, only the commits title (the commit message up to'
            ' the first new line) will be emitted.'))
Exemplo n.º 10
0
class GithubConfigForm(wtf.Form):
    branches = wtf.TextField(
        'Branches',
        validators=[wtf.Optional(), wtf.Length(max=1024)],
        description=(
            'A comma-separated list of branches to forward, or blank for all.'
            ' Ex: "master, dev"'))
    events = EventSelectField(
        'Events',
        choices=[
            ('commit_comment_created', 'Commit comment'),
            ('status_error', 'Commit status: error'),
            ('status_failure', 'Commit status: failure'),
            ('status_pending', 'Commit status: pending'),
            ('status_success', 'Commit status: success'),
            ('create_branch', 'Create branch'),
            ('create_tag', 'Create tag'),
            ('delete_branch', 'Delete branch'),
            ('delete_tag', 'Delete tag'),
            ('issue_comment_created', 'Issue comment'),
            ('issue_comment_deleted', 'Issue comment: deleted'),
            ('issue_comment_edited', 'Issue comment: edited'),
            ('issue_assigned', 'Issue: assigned'),
            ('issue_closed', 'Issue: closed'),
            ('issue_edited', 'Issue: edited'),
            ('issue_labeled', 'Issue: labeled'),
            ('issue_opened', 'Issue: opened'),
            ('issue_reopened', 'Issue: reopened'),
            ('issue_unassigned', 'Issue: unassigned'),
            ('issue_unlabeled', 'Issue: unlabeled'),
            ('pr_review_created', 'Pull request review comment'),
            ('pr_review_deleted', 'Pull request review comment: deleted'),
            ('pr_review_edited', 'Pull request review comment: edited'),
            ('pr_assigned', 'Pull request: assigned'),
            ('pr_closed', 'Pull request: closed'),
            ('pr_edited', 'Pull request: edited'),
            ('pr_labeled', 'Pull request: labeled'),
            ('pr_opened', 'Pull request: opened'),
            ('pr_reopened', 'Pull request: reopened'),
            ('pr_synchronize', 'Pull request: synchronize'),
            ('pr_unassigned', 'Pull request: unassigned'),
            ('pr_unlabeled', 'Pull request: unlabeled'),
            ('push', 'Push'),
            ('release_published', 'Release published'),
            ('member_added', 'Repo: added collaborator'),
            ('team_add', 'Repo: added to a team'),
            ('fork', 'Repo: forked'),
            ('public', 'Repo: made public'),
            ('watch_started', 'Repo: starred'),
            ('gollum_created', 'Wiki: created page'),
            ('gollum_edited', 'Wiki: edited page'),
        ])
    use_colors = wtf.BooleanField(
        'Use Colors',
        validators=[wtf.Optional()],
        default=True,
        description=(
            'If checked, commit messages will include minor mIRC coloring.'))
    show_branch = wtf.BooleanField(
        'Show Branch Name',
        validators=[wtf.Optional()],
        default=True,
        description=(
            'If checked, commit messages will include the branch name.'))
    show_tags = wtf.BooleanField(
        'Show Tags',
        validators=[wtf.Optional()],
        default=True,
        description=('If checked, changes to tags will be shown.'))
    prefer_username = wtf.BooleanField(
        'Prefer Usernames',
        validators=[wtf.Optional()],
        default=True,
        description=(
            'If checked, show github usernames instead of commiter name when'
            ' possible.'))
    full_project_name = wtf.BooleanField(
        'Full Project Name',
        validators=[wtf.Optional()],
        default=False,
        description=
        ('If checked, show the full GitHub project name (ex: notifico/notifico)'
         ' instead of the Notifico project name (ex: notifico)'))
    title_only = wtf.BooleanField(
        'Title Only',
        validators=[wtf.Optional()],
        default=False,
        description=(
            'If checked, only the commits title (the commit message up to'
            ' the first new line) will be emitted.'))
    distinct_only = wtf.BooleanField(
        'Distinct Commits Only',
        validators=[wtf.Optional()],
        default=True,
        description=(
            'Commits will only be announced the first time they are seen.'))