Fixed #238: dictfields handle numerical strings indexes.
This commit is contained in:
parent
3477b0107a
commit
d0245bb5ba
@ -1193,7 +1193,7 @@ class BaseDocument(object):
|
|||||||
for p in parts:
|
for p in parts:
|
||||||
if isinstance(d, DBRef):
|
if isinstance(d, DBRef):
|
||||||
break
|
break
|
||||||
elif p.isdigit():
|
elif isinstance(d, list) and p.isdigit():
|
||||||
d = d[int(p)]
|
d = d[int(p)]
|
||||||
elif hasattr(d, 'get'):
|
elif hasattr(d, 'get'):
|
||||||
d = d.get(p)
|
d = d.get(p)
|
||||||
@ -1224,7 +1224,7 @@ class BaseDocument(object):
|
|||||||
parts = path.split('.')
|
parts = path.split('.')
|
||||||
db_field_name = parts.pop()
|
db_field_name = parts.pop()
|
||||||
for p in parts:
|
for p in parts:
|
||||||
if p.isdigit():
|
if isinstance(d, list) and p.isdigit():
|
||||||
d = d[int(p)]
|
d = d[int(p)]
|
||||||
elif (hasattr(d, '__getattribute__') and
|
elif (hasattr(d, '__getattribute__') and
|
||||||
not isinstance(d, dict)):
|
not isinstance(d, dict)):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user