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

Method validate

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

Source from the content-addressed store, hash-verified

1636 super().__init__(**kwargs)
1637
1638 def validate(self, value):
1639 if isinstance(value, self._enum_cls):
1640 return super().validate(value)
1641 try:
1642 self._enum_cls(value)
1643 except ValueError:
1644 self.error(f"{value} is not a valid {self._enum_cls}")
1645
1646 def to_python(self, value):
1647 value = super().to_python(value)

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
validateMethod · 0.45

Tested by

no test coverage detected