Skip to main content
Help us improve Python packaging – donate today!

Use 3rd-party validators (e.g. from WTForms and colander) with marshmallow

Project Description

Latest version Travis-CI

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/ .

License

MIT licensed. See the bundled LICENSE file for more details.

Release history Release notifications

This version
History Node

2.0.0

History Node

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
marshmallow_validators-2.0.0-py2.py3-none-any.whl (7.7 kB) Copy SHA256 hash SHA256 Wheel 3.4 Dec 29, 2015
marshmallow-validators-2.0.0.tar.gz (9.9 kB) Copy SHA256 hash SHA256 Source None Dec 29, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page