Use 3rd-party validators (e.g. from WTForms and colander) with marshmallow
Project description
Homepage: http://marshmallow-validators.rtfd.org/
Use 3rd-party validators (e.g. from WTForms and colander) with marshmallow.
from marshmallow import Schema, fields
from marshmallow_validators.wtforms import from_wtforms
from wtforms.validators import Email, Length
# Leverage WTForms il8n
locales = ['de_DE', 'de']
class UserSchema(Schema):
email = fields.Str(
validate=from_wtforms([Email()], locales=locales)
)
password = fields.Str(
validate=from_wtforms([Length(min=8, max=300)], locales=locales)
)
UserSchema().validate({'email': 'invalid', 'password': 'abc'})
# {'email': ['Ungültige Email-Adresse.'],
# 'password': ['Feld muss zwischen 8 und 300 Zeichen beinhalten.']}
Get It Now
$ pip install -U marshmallow-validators
Documentation
Full documentation is available at http://marshmallow-validators.rtfd.org/ .
Project Links
License
MIT licensed. See the bundled LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for marshmallow-validators-2.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e95fa1804b49fb1d953951546ea2992820778545f597db7daccab0cfd439525 |
|
MD5 | 087efcd71a3cf84f76a047b158705ddd |
|
BLAKE2b-256 | 20ea2fb38d3931b816f2c2c0db3d51f4f8f26e95135b6577dec0f496f287d357 |
Close
Hashes for marshmallow_validators-2.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e7aa8b2f51d600c9041510c1423c2de6bce1983f5838978133329e8c1176e45 |
|
MD5 | dbdf82ae5e1024b5bca53f017a388a50 |
|
BLAKE2b-256 | 829f58a4b610c97671dff9399754e9501b7f863b74efe0c92f39c4bf5efe31e2 |