Change method of checking if a key is in the dictionary.
The original method would return false if the key contained the boolean "false" causing the value not to be deleted even if it existed.
This commit is contained in:
parent
ff609192f5
commit
dd7bf5f043
1 changed files with 1 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ def _nested_delete(document, key):
|
||||||
for list_items in document:
|
for list_items in document:
|
||||||
_nested_delete(document=list_items, key=key)
|
_nested_delete(document=list_items, key=key)
|
||||||
elif isinstance(document, dict):
|
elif isinstance(document, dict):
|
||||||
if document.get(key):
|
if key in document:
|
||||||
del document[key]
|
del document[key]
|
||||||
for dict_key, dict_value in iteritems(document):
|
for dict_key, dict_value in iteritems(document):
|
||||||
_nested_delete(document=dict_value, key=key)
|
_nested_delete(document=dict_value, key=key)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue