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"))
# 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,_"))
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()
#!/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"))
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
from flaskext.wtf import regexp from flaskext.babel import lazy_gettext as _ USERNAME_RE = r'^[\w.+-]+$' is_username = regexp(USERNAME_RE, message=u'您只能使用字母,数字或破折号')
: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'))
#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()
#!/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()