Skip to main content
https://img.shields.io/pypi/v/styler_validation.svg https://github.com/STYLER-Inc/styler-validation/workflows/Python%20package/badge.svg

Validators to be used as mixins in models

  • Free software: MIT license

Usage

Install from pypi:

pip install styler-validation

Set validation rules for a class

from styler_validation import ValidatorMixin
from styler_validation import validators as va


class User(ValidatorMixin):
    validates = [
        ('name', va.is_required()),
        ('age', va.is_required(), va.is_integer())
    ]

my_user = User()
result, errors = my_user.is_valid()

print(result)   # False
print(errors)   # {'user.name': ('required_value',), 'user.age': ('required_value',)}

my_user.name = 'John Doe'
my_user.age = 'nine'
result, errors = my_user.is_valid()

print(result)   # False
print(errors)   # {'user.age': ('invalid_value',)}

Download files

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

Source Distribution

styler_validation-1.0.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

styler_validation-1.0.0-py2.py3-none-any.whl (5.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file styler_validation-1.0.0.tar.gz.

File metadata

  • Download URL: styler_validation-1.0.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.1

File hashes

Hashes for styler_validation-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4e605e86d6d1981175ba61ad2e2095c25f57a12cb64ae103692ac869a5eebcf7
MD5 06e3d25e60662692c875fceb1ee7e5fe
BLAKE2b-256 8063ce1e916d19ad45aa9aea512e9f53d44e12504d6f9fc66fd89f2d835a565b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: styler_validation-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.1

File hashes

Hashes for styler_validation-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 614cf7e01ec91d267e7335530d05b1e5b3f8fc705ed769328c9579dcf334dee1
MD5 f52e9c82efbad3f7bde9e2e10b5bb2c5
BLAKE2b-256 404d37347504142daa563b0d1f0b5a86010879aee7e4d045fea5091fd8e7e539

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page