MCPcopy Create free account
hub / github.com/MongoEngine/mongoengine / _to_mongo_safe_call

Method _to_mongo_safe_call

mongoengine/base/fields.py:225–235  ·  view source on GitHub ↗

Helper method to call to_mongo with proper inputs.

(self, value, use_db_field=True, fields=None)

Source from the content-addressed store, hash-verified

223 return self.to_python(value)
224
225 def _to_mongo_safe_call(self, value, use_db_field=True, fields=None):
226 """Helper method to call to_mongo with proper inputs."""
227 f_inputs = self.to_mongo.__code__.co_varnames
228 ex_vars = {}
229 if "fields" in f_inputs:
230 ex_vars["fields"] = fields
231
232 if "use_db_field" in f_inputs:
233 ex_vars["use_db_field"] = use_db_field
234
235 return self.to_mongo(value, **ex_vars)
236
237 def prepare_query_value(self, op, value):
238 """Prepare a value that is being used in a query for PyMongo."""

Callers 1

to_mongoMethod · 0.80

Calls 1

to_mongoMethod · 0.95

Tested by

no test coverage detected