Skip to main content

Python3 Validation in another way

Project description

SmileValidation

smilevalidator

Python3 Validation in another way

I hurt enough for validating those form's elements. Time to bring a new reference type.

It's gonna solve like this way:

from Validator import Validator
from Rule import Rule

Rule

It is the collection of what we wanna validate to those element objects

Example:
Add this to Rule.py as piece of an element validation.

# field
self.__emailOne		= self.__type.getString(
    require= True
    , maxLength= 75
    , minLength= 8
    , unicode= False
    , regex= None
)

Create a test.py for testing reason.\

from Validator import Validator
from Rule import Rule

# instance 
rule			= Rule()
validator		= Validator()

# emailOne is an element of html form
validator.addElement(
    elementName ='emailOne'
    , elementValue= 'masako'
    , rule= rule.getEmailOne()
)

if validator.isValid():
	print(f'Valid')
else:
	print(f'Invalid')
    # get error with showing the happening of the element
    print(f'{validator.getError()}')

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

SmileValidation-1.0.1.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

SmileValidation-1.0.1-py3-none-any.whl (14.6 kB view hashes)

Uploaded Python 3

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