MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / validate

Method validate

cassandra/cqlengine/columns.py:383–393  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

381 super(Text, self).__init__(**kwargs)
382
383 def validate(self, value):
384 value = super(Text, self).validate(value)
385 if not isinstance(value, (str, bytearray)) and value is not None:
386 raise ValidationError('{0} {1} is not a string'.format(self.column_name, type(value)))
387 if self.max_length is not None:
388 if value and len(value) > self.max_length:
389 raise ValidationError('{0} is longer than {1} characters'.format(self.column_name, self.max_length))
390 if self.min_length:
391 if (self.min_length and not value) or len(value) < self.min_length:
392 raise ValidationError('{0} is shorter than {1} characters'.format(self.column_name, self.min_length))
393 return value
394
395
396class Ascii(Text):

Callers

nothing calls this directly

Calls 2

ValidationErrorClass · 0.90
validateMethod · 0.45

Tested by

no test coverage detected