MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / validate

Method validate

mongoengine/fields.py:392–406  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

390 return value
391
392 def validate(self, value):
393 if isinstance(value, int):
394 try:
395 value = float(value)
396 except OverflowError:
397 self.error("The value is too large to be converted to float")
398
399 if not isinstance(value, float):
400 self.error("FloatField only accepts float and integer values")
401
402 if self.min_value is not None and value < self.min_value:
403 self.error("Float value is too small")
404
405 if self.max_value is not None and value > self.max_value:
406 self.error("Float value is too large")
407
408 def prepare_query_value(self, op, value):
409 if value is None:

Callers

nothing calls this directly

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected