in the mid DictField key can accept dollar sign

This commit is contained in:
Hendri Karisma
2018-03-22 20:07:52 +07:00
committed by Bastien Gérard
parent 2c6a744848
commit a32c893078
3 changed files with 6459 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):