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

Method __get__

mongoengine/fields.py:1496–1507  ·  view source on GitHub ↗
(self, instance, owner)

Source from the content-addressed store, hash-verified

1494 return ref_cls._from_son(dereferenced_son)
1495
1496 def __get__(self, instance, owner):
1497 if instance is None:
1498 return self
1499
1500 value = instance._data.get(self.name)
1501
1502 auto_dereference = instance._fields[self.name]._auto_dereference
1503 if auto_dereference and isinstance(value, dict):
1504 doc_cls = get_document(value["_cls"])
1505 instance._data[self.name] = self._lazy_load_ref(doc_cls, value["_ref"])
1506
1507 return super().__get__(instance, owner)
1508
1509 def validate(self, value):
1510 if not isinstance(value, (Document, DBRef, dict, SON)):

Callers

nothing calls this directly

Calls 4

_lazy_load_refMethod · 0.95
get_documentFunction · 0.90
getMethod · 0.45
__get__Method · 0.45

Tested by

no test coverage detected