File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1818)
1919
2020from django_mongodb_backend .lookups import builtin_lookup_expr , builtin_lookup_path
21- from django_mongodb_backend .query_utils import process_lhs , process_rhs , valid_path_key_name
21+ from django_mongodb_backend .query_utils import process_lhs , process_rhs
22+
23+
24+ def valid_path_key_name (key_name ):
25+ # A value can use path syntax (field.subfield.) unless it contains a
26+ # dollar sign or period.
27+ return not any (char in key_name for char in ("$" , "." ))
2228
2329
2430def build_json_mql_path (lhs , key_transforms , as_expr = False ):
Original file line number Diff line number Diff line change 1- import re
2-
31from django .core .exceptions import FullResultSet
42from django .db .models .aggregates import Aggregate
53from django .db .models .expressions import CombinedExpression , Func , Value
@@ -82,7 +80,3 @@ def is_constant_value(value):
8280 # Allow Func with can_use_path as a temporary exception.
8381 (isinstance (value , Func ) and value .can_use_path )
8482 )
85-
86-
87- def valid_path_key_name (key_name ):
88- return bool (re .fullmatch (r"[A-Za-z0-9_]+" , key_name ))
You can’t perform that action at this time.
0 commit comments