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

Method to_python

mongoengine/fields.py:2502–2508  ·  view source on GitHub ↗

Convert a MongoDB-compatible type to a Python type.

(self, value)

Source from the content-addressed store, hash-verified

2500 return pk
2501
2502 def to_python(self, value):
2503 """Convert a MongoDB-compatible type to a Python type."""
2504 if not isinstance(value, (DBRef, Document, EmbeddedDocument)):
2505 collection = self.document_type._get_collection_name()
2506 value = DBRef(collection, self.document_type.id.to_python(value))
2507 value = self.build_lazyref(value)
2508 return value
2509
2510 def validate(self, value):
2511 if isinstance(value, LazyReference):

Callers

nothing calls this directly

Calls 3

build_lazyrefMethod · 0.95
_get_collection_nameMethod · 0.45
to_pythonMethod · 0.45

Tested by

no test coverage detected