Documentation updates
This commit is contained in:
parent
7451244cd2
commit
f0d4e76418
@ -88,3 +88,8 @@ Fields
|
||||
.. autoclass:: mongoengine.fields.GridFSProxy
|
||||
.. autoclass:: mongoengine.fields.ImageGridFsProxy
|
||||
.. autoclass:: mongoengine.fields.ImproperlyConfigured
|
||||
|
||||
Misc
|
||||
====
|
||||
|
||||
.. autofunction:: mongoengine.common._import_class
|
||||
|
@ -82,8 +82,7 @@ class BaseField(object):
|
||||
BaseField.creation_counter += 1
|
||||
|
||||
def __get__(self, instance, owner):
|
||||
"""Descriptor for retrieving a value from a field in a document. Do
|
||||
any necessary conversion between Python and MongoDB types.
|
||||
"""Descriptor for retrieving a value from a field in a document.
|
||||
"""
|
||||
if instance is None:
|
||||
# Document class being used rather than a document object
|
||||
|
@ -2,7 +2,19 @@ _class_registry_cache = {}
|
||||
|
||||
|
||||
def _import_class(cls_name):
|
||||
"""Cached mechanism for imports"""
|
||||
"""Cache mechanism for imports.
|
||||
|
||||
Due to complications of circular imports mongoengine needs to do lots of
|
||||
inline imports in functions. This is inefficient as classes are
|
||||
imported repeated throughout the mongoengine code. This is
|
||||
compounded by some recursive functions requiring inline imports.
|
||||
|
||||
:mod:`mongoengine.common` provides a single point to import all these
|
||||
classes. Circular imports aren't an issue as it dynamically imports the
|
||||
class when first needed. Subsequent calls to the
|
||||
:func:`~mongoengine.common._import_class` can then directly retrieve the
|
||||
class from the :data:`mongoengine.common._class_registry_cache`.
|
||||
"""
|
||||
if cls_name in _class_registry_cache:
|
||||
return _class_registry_cache.get(cls_name)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user