class SettingsForm(BaseForm): width = fields.IntegerField('width', validators=[validators.NumberRange(min=0)]) height = fields.IntegerField('width', validators=[validators.NumberRange(min=0)]) resample = fields.StringField( 'resample', validators=[ validators.Optional(), validators.AnyOf(['NEAREST', 'BILINEAR', 'BICUBIC', 'LANCZOS']) ])
class PaginationForm(BaseForm): after = fields.HiddenField(coerce=form_utils.to_object_id) before = fields.HiddenField(coerce=form_utils.to_object_id) limit = fields.IntegerField( 'Limit', validators=[validators.NumberRange(1, 100)], default=10 )
class SettingsForm(BaseForm): max_colors = fields.IntegerField('max_colors', validators=[ validators.Optional(), validators.NumberRange(min=1, max=32) ], default=8) min_weight = fields.FloatField('min_weight', validators=[ validators.Optional(), validators.NumberRange(min=0, max=1) ], default=0.015) max_sample_size = fields.IntegerField( 'max_colors', validators=[validators.Optional(), validators.NumberRange(min=0)], default=512)
class SettingsForm(BaseForm): top = fields.FloatField( 'top', validators=[validators.NumberRange(min=0, max=1)] ) left = fields.FloatField( 'left', validators=[validators.NumberRange(min=0, max=1)] ) bottom = fields.FloatField( 'bottom', validators=[validators.NumberRange(min=0, max=1)] ) right = fields.FloatField( 'right', validators=[validators.NumberRange(min=0, max=1)] )
class SettingsForm(BaseForm): aspect_ratio = fields.FloatField('aspect_ratio', validators=[validators.Optional()]) padding_top = fields.FloatField( 'padding_top', validators=[validators.Optional(), validators.NumberRange(min=0)], default=0) padding_left = fields.FloatField( 'padding_left', validators=[validators.Optional(), validators.NumberRange(min=0)], default=0) padding_bottom = fields.FloatField( 'padding_bottom', validators=[validators.Optional(), validators.NumberRange(min=0)], default=0) padding_right = fields.FloatField( 'padding_right', validators=[validators.Optional(), validators.NumberRange(min=0)], default=0) def validate_aspect_ratio(form, field): if field.data: if (form.padding_top.data or form.padding_left.data or form.padding_bottom.data or form.padding_right.data): raise validators.ValidationError( 'Not applicable when padding has been specified.')
class PutForm(BaseForm): name = fields.StringField( 'name', validators=[validators.Optional()] ) expire = fields.IntegerField( 'expire', validators=[ validators.Optional(), validators.NumberRange(min=1) ] ) secure = fields.BooleanField('secure')
class SettingsForm(BaseForm): image_format = fields.StringField( 'image_format', validators=[ validators.Required(), validators.AnyOf(IMAGE_FORMATS.keys()) ] ) quality = fields.IntegerField( 'quality', validators=[ validators.Optional(), validators.NumberRange(min=0, max=100) ], default=80 ) lossless = fields.BooleanField('lossless') progressive = fields.BooleanField('progressive') versioned = fields.BooleanField('versioned')
class ExpireForm(BaseForm): seconds = fields.IntegerField( 'seconds', validators=[validators.NumberRange(min=0)] )