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-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70a19128666514a329c902a702575aa9d979735259bfeb689e192bc28d134ba6 |
|
MD5 | 1fc4beb4a64c7468937b39aa5a49a74b |
|
BLAKE2b-256 | 2fd28aa3e22d0af70ee7ccc709cf1c1a7ee826a21a1adc8affbfe211eca911a9 |
Close
Hashes for marshmallow_validators-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc0a8e991dbf334a4c546b6e713eb0faa66424a37f9ee320cfce1d2299bf6be3 |
|
MD5 | 78ce2c40e8e4f14f85f181a7e3cf9f29 |
|
BLAKE2b-256 | 46d16f1b71abfbced531136941866c475976e6a122e7885b4948fa3e38a63327 |