Merge pull request #1975 from bagerard/dictfield-key-with-dollar-char__clone

PR CLONE - Dictfield key with dollar char  clone
This commit is contained in:
Bastien Gérard
2018-12-27 23:02:00 +01:00
committed by GitHub
2 changed files with 10 additions and 3 deletions

View File

@@ -944,7 +944,7 @@ def key_has_dot_or_dollar(d):
dictionary contains a dot or a dollar sign.
"""
for k, v in d.items():
if ('.' in k or '$' in k) or (isinstance(v, dict) and key_has_dot_or_dollar(v)):
if ('.' in k or k.startswith('$')) or (isinstance(v, dict) and key_has_dot_or_dollar(v)):
return True
@@ -977,7 +977,7 @@ class DictField(ComplexBaseField):
self.error(msg)
if key_has_dot_or_dollar(value):
self.error('Invalid dictionary key name - keys may not contain "."'
' or "$" characters')
' or startswith "$" characters')
super(DictField, self).validate(value)
def lookup_member(self, member_name):