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

Method __get__

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

Source from the content-addressed store, hash-verified

1350 return ref_cls._from_son(dereferenced_son)
1351
1352 def __get__(self, instance, owner):
1353 if instance is None:
1354 # Document class being used rather than a document object
1355 return self
1356
1357 # Get value from document instance if available
1358 value = instance._data.get(self.name)
1359 auto_dereference = instance._fields[self.name]._auto_dereference
1360
1361 # Dereference DBRefs
1362 if auto_dereference and isinstance(value, DBRef):
1363 instance._data[self.name] = self._lazy_load_ref(self.document_type, value)
1364
1365 return super().__get__(instance, owner)
1366
1367 def to_mongo(self, document, use_db_field=True, fields=None):
1368 id_field_name = self.document_type._meta["id_field"]

Callers

nothing calls this directly

Calls 3

_lazy_load_refMethod · 0.95
getMethod · 0.45
__get__Method · 0.45

Tested by

no test coverage detected