21 """Base class that doesn't do anything yet, but is a convenient
22 place to add any functionality that is common to all validators.
28 """Automatically passes all values.
35class NullValidator(BaseValidator):
36 """Throws an exception on NULL values.
40 raise Exception(f
'{fieldname} cannot be null!')
44 """Throws an exception on blank values.
48 raise Exception(f
'{fieldname} cannot be blank!')
52 """Throws an exception on invalid email addresses.
54 Note that this is a simple regex, so it won't validate more advanced
58 if not re.match(
r"/[a-z0-9!#%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9] (?:[a-z0-9-]*[a-z0-9])?/i", value):
59 raise Exception(f
'{value} is not a valid email address!')
63 """Throws an exception on invalid date strings.
65 Note that this simpy uses dateutil's parse(), so it won't
66 validate more advanced dates.
70 dateutil.parser.parse(value)
72 raise Exception(f
'{value} is not a valid date!')
76 """Throws an exception on invalid time strings.
78 Note that this simpy uses dateutil's parse(), so it won't
79 validate more advanced dates.
83 dateutil.parser.parse(value)
85 raise Exception(f
'{value} is not a valid time!')
89 """Throws an exception on invalid datetime strings.
91 Note that this simpy uses dateutil's parse(), so it won't
92 validate more advanced dates.
96 dateutil.parser.parse(value)
98 raise Exception(f
'{value} is not a valid date!')
102 """Throws an exception if the value is too high or too low.
113 raise Exception(f
'{value} is too low for {fieldname}!')
116 raise Exception(f
'{value} is too high for {fieldname}!')
Base class that doesn't do anything yet, but is a convenient place to add any functionality that is c...
Throws an exception on blank values.
def __call__(self, fieldname, value)
Throws an exception on invalid datetime strings.
def __call__(self, fieldname, value)
Throws an exception on invalid date strings.
def __call__(self, fieldname, value)
Throws an exception on invalid email addresses.
def __call__(self, fieldname, value)
Automatically passes all values.
def __call__(self, fieldname, value)
def __call__(self, fieldname, value)
Throws an exception if the value is too high or too low.
def __call__(self, fieldname, value)
def __init__(self, min, max)
Throws an exception on invalid time strings.
def __call__(self, fieldname, value)