Skip to main content

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.

Project details


Download files

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

Source Distribution

marshmallow-validators-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

marshmallow_validators-1.0.0-py2.py3-none-any.whl (7.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file marshmallow-validators-1.0.0.tar.gz.

File metadata

File hashes

Hashes for marshmallow-validators-1.0.0.tar.gz
Algorithm Hash digest
SHA256 70a19128666514a329c902a702575aa9d979735259bfeb689e192bc28d134ba6
MD5 1fc4beb4a64c7468937b39aa5a49a74b
BLAKE2b-256 2fd28aa3e22d0af70ee7ccc709cf1c1a7ee826a21a1adc8affbfe211eca911a9

See more details on using hashes here.

Provenance

File details

Details for the file marshmallow_validators-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for marshmallow_validators-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dc0a8e991dbf334a4c546b6e713eb0faa66424a37f9ee320cfce1d2299bf6be3
MD5 78ce2c40e8e4f14f85f181a7e3cf9f29
BLAKE2b-256 46d16f1b71abfbced531136941866c475976e6a122e7885b4948fa3e38a63327

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page