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

Method validate

mongoengine/fields.py:814–826  ·  view source on GitHub ↗
(self, value, clean=True)

Source from the content-addressed store, hash-verified

812 return value
813
814 def validate(self, value, clean=True):
815 if self.choices and isinstance(value, SON):
816 for choice in self.choices:
817 if value["_cls"] == choice._class_name:
818 return True
819
820 if not isinstance(value, EmbeddedDocument):
821 self.error(
822 "Invalid embedded document instance provided to an "
823 "GenericEmbeddedDocumentField"
824 )
825
826 value.validate(clean=clean)
827
828 def lookup_member(self, member_name):
829 document_choices = self.choices or []

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
validateMethod · 0.45

Tested by

no test coverage detected