The Debian Member Portfolio Service https://portfolio.debian.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

42 lines
1.4 KiB

from __future__ import unicode_literals
from flask.ext.babel import gettext as _
from flask.ext.wtf import Form
from wtforms import IntegerField, StringField, RadioField
from wtforms.validators import (
AnyOf, DataRequired, Email, Length, Optional, Regexp
)
class FingerPrint(Regexp):
def __init__(self, **kwargs):
super(FingerPrint, self).__init__(r'^[a-fA-F0-9]*$', **kwargs)
class PlainText(Regexp):
def __init__(self, **kwargs):
super(PlainText, self).__init__(r'^[a-zA-Z\-0-9]*$')
class DeveloperData(Form):
email = StringField('email', validators=[DataRequired(), Email()])
name = StringField('name', validators=[DataRequired()])
gpgfp = StringField('gpgfp', validators=[
FingerPrint(),
Length(min=32, max=40)
])
username = StringField('username', validators=[PlainText()])
nonddemail = StringField('nonddemail', validators=[Email()])
aliothusername = StringField('aliothusername', validators=[PlainText()])
mode = RadioField(
'mode', default='html', choices=[
('json', _('JSON')), ('html', _('HTML'))
], validators=[AnyOf(['json', 'html'])]
)
forumsid = IntegerField('forumsid', default=None, validators=[Optional()])
wikihomepage = StringField('wikihomepage', default=None, validators=[
Optional()])
class DeveloperDataRequest(Form):
email = StringField('email', validators=[DataRequired(), Email()])