Exemple #1
0
class RegistrationForm(Form):
    name = fields.TextField(validators=[validators.required()])
    email = fields.TextField(validators=[validators.Email()])
    password = fields.PasswordField(validators=[validators.required()])
    conf_password = fields.PasswordField(validators=[validators.required()])
    def validate_login(self, field):
        if db.session.query(User).filter_by(username=self.username.data).count() > 0:
            raise validators.ValidationError('Duplicate username')
Exemple #2
0
class ContentCreate_Form(Form):
    next = HiddenField()
    tags_csv = HiddenField()
    title = TextField(
        "Title",
        validators=[validators.required(),
                    validators.Length(max=128)])
    teaser = TextAreaField(
        "Teaser",
        validators=[validators.required(),
                    validators.Length(max=200)])
    content = TextAreaField("Body", validators=[validators.Required()])
    #recaptcha = RecaptchaField()
    submit = SubmitField("Submit")
Exemple #3
0
class LoginForm(Form):
    name = fields.TextField(validators=[validators.required()])
    password = fields.PasswordField(validators=[validators.required()])

    def validate_login(self, field):
        user = self.get_user()

        if user is None:
            raise validators.ValidationError('Invalid user')

        if user.password != self.password.data:
            raise validators.ValidationError('Invalid password')

    def get_user(self):
        print self.name.data, "here"
        return db.session.query(User).filter_by(name=self.name.data).first()
Exemple #4
0
class job_form(Form):
    vcf = FileField(u'VCF File', [
        make_optional('uri'),
        validators.required(message=u'You need to supply a VCF file')
    ])
    uri = TextField(u'VCF URI', [
        make_optional('vcf'),
        validators.URL(
            message=
            u'You must specify a valid URI (e.g. "localhost" is not allowed)')
    ])

    min_variant_quality = IntegerField(u'Minimum Variant Quality',
                                       [validators.NumberRange(min=0, max=99)],
                                       default=30)
    min_quality_depth = IntegerField(u'Minimum Quality by Depth',
                                     [validators.NumberRange(min=0)],
                                     default=10)
    homozyg_window_size = IntegerField(u'Homozygosity Window Size',
                                       [validators.NumberRange(min=0)],
                                       default=1000)
    heterozyg_calls = IntegerField(u'Heterozygous Calls allowed in window',
                                   [validators.NumberRange(min=0)],
                                   default=10)

    def validate_vcf(form, field):
        m = re.match(
            '^.*\.(' + '|'.join(app.config['UPLOAD_FORMAT_EXTENSIONS']) + ')$',
            field.data.filename, re.IGNORECASE)
        if not m:
            raise ValidationError(
                u'You must upload a VCF file (compressed or uncompressed)')
Exemple #5
0
class check_form(Form):
    token = TextField(
        u'Submission token',
        [validators.required(message=u'You must specify a submission token')])

    def validate_token(form, field):
        m = re.match(app.config['TOKEN_REGEX'], field.data)
        if not m:
            raise ValidationError(u'You must supply a valid token')
Exemple #6
0
class RegisterSiteForm(Form):
    base_url = fields.TextField(validators=[validators.required()])
Exemple #7
0
class ImageSettingsForm(Form):
	allow_image_resize = BooleanField(u'Allow Image Resizing', [validators.required()])
	image_size_width = IntegerField(u'Image Width', [validators.required()])
	image_size_height = IntegerField(u'Image Height', [validators.required()])
	thumb_size_width = IntegerField(u'Thumbnail Width', [validators.required()])
	thumb_size_height = IntegerField(u'Thumbnail Height', [validators.required()])
Exemple #8
0
class Comment_Form(Form):
    content = TextAreaField(
        "Comment",
        validators=[validators.required(),
                    validators.Length(max=1024)])
    refers_to = HiddenField()
Exemple #9
0
class ContentEdit_Form(ContentCreate_Form):
    edit_summary = TextField(
        "Edit Summary",
        validators=[validators.required(),
                    validators.Length(max=128)])