Ejemplo n.º 1
0
from flaskext.wtf import regexp

from flaskext.babel import lazy_gettext as _

USERNAME_RE = r'^[\w.+-]+$'

is_username = regexp(USERNAME_RE, 
                     message=_("You can only use letters, numbers or dashes"))


Ejemplo n.º 2
0
# coding: utf-8

from flaskext.wtf import regexp
from flaskext.babel import lazy_gettext as _

is_username = regexp(r'^\w+$', message=_("You can only use a-z,A-Z,0-9,_"))
Ejemplo n.º 3
0
    RecaptchaField,
    TextAreaField,
    SubmitField,
    DateField,
    DateTimeField,
    FileField,
    SelectField,
    ValidationError,
    required,
    email,
    equal_to,
    url,
    optional,
    regexp,
    length,
    validators,
)

is_num = regexp(r"^\d{0,12}$", message=u"请填写数字")


class CashForm(Form):

    alipay = TextField(u"支付宝账户", validators=[required(message=u"请填写支付宝邮箱地址"), email(message=u"邮箱格式错误")])

    money = TextField(u"提现金额", validators=[required(message=u"请填写您要提现的金额"), is_num])

    submit = SubmitField()

    hidden = HiddenField()
Ejemplo n.º 4
0
#!/usr/bin/env python
#coding=utf-8
"""
    validators.py
    ~~~~~~~~~~~~~

    :license: BSD, see LICENSE for more details.
"""
from flaskext.wtf import regexp

from flaskext.babel import lazy_gettext as _

USERNAME_RE = r'^[\w.+-]+$'

is_username = regexp(USERNAME_RE,
                     message=_("You can only use letters, numbers or dashes"))
Ejemplo n.º 5
0
Archivo: terms.py Proyecto: julen/tzos
from flaskext.wtf import AnyOf, BooleanField, FieldList, FileField, Form, \
        HiddenField, Optional, SelectField, SubmitField, TextAreaField, \
        TextField, ValidationError, regexp, required

from tzos.extensions import dbxml
from tzos.forms.fields import BooleanWorkingField, MultipleTextField, \
        OriginatingPerson, SelectMultipleFieldDyn, SelectFieldPlus, SubjectField
from tzos.strings import *


#
# Validators
#

DISPLAY_NAME_RE = r'^[^_0-9\+]+$'
is_display_name = regexp(DISPLAY_NAME_RE,
                         message=_(u"You can only use letters."))

class NotContains(object):
    """
    Checks the incoming data doesn't contain a sequence of invalid inputs.

    :param values:
        A sequence of invalid inputs.
    :param message:
        Error message to raise in case of a validation error. `%(values)s`
        contains the value which caused the error.
    """
    def __init__(self, values, message=None):
        self.values = values
        self.message = message
Ejemplo n.º 6
0
from flaskext.wtf import regexp

from flaskext.babel import lazy_gettext as _

USERNAME_RE = r'^[\w.+-]+$'

is_username = regexp(USERNAME_RE, 
                     message=u'您只能使用字母,数字或破折号')


Ejemplo n.º 7
0
    :copyright: (c) 2011 Julen Ruiz Aizpuru.
    :license: BSD, see LICENSE for more details.
"""
from flask import current_app

from flaskext.babel import gettext, lazy_gettext as _
from flaskext.wtf import BooleanField, Form, HiddenField, Optional, \
    PasswordField, RecaptchaField, SubmitField, TextField, URL, \
    ValidationError, email, equal_to, regexp, required

from tzos.models import User

USERNAME_RE = r'^[\w.+-]+$'

is_username = regexp(USERNAME_RE,
                     message=_(u"You can only use letters, numbers or dashes."))

FULLNAME_RE = r'^[A-Za-z\W]+\s[A-Za-z\W]+$'

is_fullname = regexp(FULLNAME_RE,
                     message=_(u"This doesn't seem to be a full name."))

class LoginForm(Form):
    next = HiddenField()

    login = TextField(_(u'Username or email address'), validators=[
                      required(message=\
                               _(u'You must provide an email or username.'))])

    password = PasswordField(_(u'Password'))
Ejemplo n.º 8
0
#coding=utf-8

"""
    forms/tweets.py
    ~~~~~~~~~~~~~
    :license: BSD, see LICENSE for more details.
"""

from flask import g

from flaskext.wtf import Form, TextField, PasswordField, HiddenField, \
    BooleanField, RadioField, RecaptchaField, TextAreaField, SubmitField, \
    DateField, DateTimeField, FileField, SelectField, ValidationError,\
    required, email, equal_to, url, optional, regexp, length, validators

is_num = regexp(r'^\d{0,12}$', message=u"请填写整数")

class CashForm(Form):
    
    alipay = TextField(u"支付宝账户",validators=[
                required(message=u"请填写支付宝邮箱地址"), 
                email(message=u"邮箱格式错误")])

    money = TextField(u"提现金额", validators=[
                required(message=u"请填写您要提现的金额"),
                is_num])

    submit = SubmitField(u"提交")
    
    hidden = HiddenField()
Ejemplo n.º 9
0
#!/usr/bin/env python
#coding=utf-8
"""
    forms/tweets.py
    ~~~~~~~~~~~~~
    :license: BSD, see LICENSE for more details.
"""

from flask import g

from flaskext.wtf import Form, TextField, PasswordField, HiddenField, \
    BooleanField, RadioField, RecaptchaField, TextAreaField, SubmitField, \
    DateField, DateTimeField, FileField, SelectField, ValidationError,\
    required, email, equal_to, url, optional, regexp, length, validators

is_num = regexp(r'^\d{0,12}$', message=u"请填写整数")


class CashForm(Form):

    alipay = TextField(
        u"支付宝账户",
        validators=[required(message=u"请填写支付宝邮箱地址"),
                    email(message=u"邮箱格式错误")])

    money = TextField(u"提现金额",
                      validators=[required(message=u"请填写您要提现的金额"), is_num])

    submit = SubmitField(u"提交")

    hidden = HiddenField()