code style
This commit is contained in:
parent
1e57fb4609
commit
0f2aca62f3
@ -13,6 +13,7 @@ class RequiredValidator(Validator):
|
||||
if value is None or value == "":
|
||||
raise ValidationError(key, "Field is required")
|
||||
|
||||
|
||||
class RangeValidator(Validator):
|
||||
def __init__(self, minValue, maxValue):
|
||||
self.minValue = minValue
|
||||
@ -23,4 +24,6 @@ class RangeValidator(Validator):
|
||||
return # Ignore empty values
|
||||
n = float(value)
|
||||
if n < self.minValue or n > self.maxValue:
|
||||
raise ValidationError(key, 'Value must be between %s and %s'%(self.minValue, self.maxValue))
|
||||
raise ValidationError(
|
||||
key, "Value must be between {min} and {max}".format(min=self.minValue, max=self.maxValue)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user