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

Method __init__

mongoengine/context_managers.py:104–113  ·  view source on GitHub ↗

Construct the switch_collection context manager. :param cls: the class to change the registered db :param collection_name: the name of the collection to use

(self, cls, collection_name)

Source from the content-addressed store, hash-verified

102 """
103
104 def __init__(self, cls, collection_name):
105 """Construct the switch_collection context manager.
106
107 :param cls: the class to change the registered db
108 :param collection_name: the name of the collection to use
109 """
110 self.cls = cls
111 self.ori_collection = cls._get_collection()
112 self.ori_get_collection_name = cls._get_collection_name
113 self.collection_name = collection_name
114
115 def __enter__(self):
116 """Change the _get_collection_name and clear the cached collection."""

Callers

nothing calls this directly

Calls 1

_get_collectionMethod · 0.80

Tested by

no test coverage detected