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

Method field_path_sub

mongoengine/queryset/base.py:2008–2013  ·  view source on GitHub ↗
(match)

Source from the content-addressed store, hash-verified

2006 return '["%s"]' % fields[-1].db_field
2007
2008 def field_path_sub(match):
2009 # Extract just the field name, and look up the field objects
2010 field_name = match.group(1).split(".")
2011 fields = self._document._lookup_field(field_name)
2012 # Substitute the correct name for the field into the javascript
2013 return ".".join([f.db_field for f in fields])
2014
2015 code = re.sub(r"\[\s*~([A-z_][A-z_0-9.]+?)\s*\]", field_sub, code)
2016 code = re.sub(r"\{\{\s*~([A-z_][A-z_0-9.]+?)\s*\}\}", field_path_sub, code)

Callers

nothing calls this directly

Calls 2

_lookup_fieldMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected