예제 #1
0
class BadgeForm(formencode.Schema):
    allow_extra_fields = True
    title = All(validators.String(max=40, not_empty=True), ContainsChar())
    description = validators.String(max=255)
    color = ValidHTMLColor()
    group = Any(validators.Empty, ValidGroup())
    display_group = validators.StringBoolean(if_missing=False)
    badge_delegateable = validators.StringBoolean(if_missing=False)
예제 #2
0
class NewFormValidator(Schema):
    username = validators.UnicodeString(not_empty=True)
    firstname = validators.UnicodeString(not_empty=True)
    lastname = validators.UnicodeString(not_empty=True)
    email = validators.UnicodeString(not_empty=True)
    password = validators.UnicodeString(not_empty=False)
    enabled = validators.StringBoolean(if_missing=False)
예제 #3
0
class ProfileForm(Schema):
    allow_extra_fields = True
    filter_extra_fields = True
    delete = validators.StringBoolean(if_missing=False)
    identifier = validators.OpenId(not_empty=True)
    name = validators.UnicodeString(not_empty=True, strip=True)
    email = validators.Email(not_empty=False, resolve_domain=True)
    website = validators.URL(add_http=True)
예제 #4
0
class PostForm(Schema):
    allow_extra_fields = True
    filter_extra_fields = True
    delete = validators.StringBoolean(if_missing=False)
    title = validators.UnicodeString(not_empty=True, strip=True)
    category_id = CategoryId()
    category_title = CategoryTitle()
    slug = validators.UnicodeString(strip=True)
    summary = validators.UnicodeString()
    content = validators.UnicodeString(not_empty=True, strip=True)
예제 #5
0
class NewUserSchema(AuthFormSchema):
    "Validate new users."
    allow_extra_fields = False
    username = UniqueUsername(not_empty=True)
    password = validators.String(if_missing=None)
    confirm_password = validators.String(if_missing=None)
    name = validators.String(not_empty=False)
    resident = validators.StringBoolean(not_empty=True)
    chained_validators = [
        validators.FieldsMatch('password', 'confirm_password'),
    ]
예제 #6
0
class UserBadgeForm(BadgeForm):
    group = Any(validators.Empty, ValidInstanceGroup())
    display_group = validators.StringBoolean(if_missing=False)
예제 #7
0
class CommentUserForm(Schema):
    allow_extra_fields = True
    filter_extra_fields = True
    comment = validators.UnicodeString(not_empty=True, strip=True)
    delete = validators.StringBoolean(if_missing=False)
예제 #8
0
class CategoryForm(Schema):
    allow_extra_fields = True
    filter_extra_fields = True
    delete = validators.StringBoolean(if_missing=False)
    title = CategoryTitle(not_empty=True, strip=True)