Пример #1
0
 def validate(self, value):
     if not self.pattern.match(value):
         raise exceptions.ValidationError(u"Value {0} has not matched with regex.".format(value))
     return True
Пример #2
0
 def validate(self, value):
     if not self.expression.search(value.strip()):
         raise exceptions.ValidationError(u"Value {0} is not a valid email.".format(value))
     return True
Пример #3
0
 def validate(self, value):
     if not value >= self.min_value:
         raise exceptions.ValidationError(u"Value {0} is less than min value.".format(value))
     return True
Пример #4
0
 def validate(self, value):
     if not value <= self.max_value:
         raise exceptions.ValidationError(u"Value {0} is greater than max value.".format(value))
     return True
Пример #5
0
 def validate(self, value):
     if not self.min_value <= value <= self.max_value:
         raise exceptions.ValidationError(u"Value {0} is out of range.".format(value))
     return True
Пример #6
0
 def _to_python(self, value):
     if value != self.identifier:
         raise exceptions.ValidationError()
     return self.identifier
Пример #7
0
 def _to_python(self, value):
     if value not in self.values:
         raise exceptions.ValidationError(u"Value {} is not a valid value.")
     return value