fix small finding from review on py2py3 compat

This commit is contained in:
Bastien Gérard 2019-06-18 22:55:51 +02:00
parent 7e0ba1b335
commit 82af5e4a19

View File

@ -3,6 +3,7 @@ import numbers
from functools import partial from functools import partial
from bson import DBRef, ObjectId, SON, json_util from bson import DBRef, ObjectId, SON, json_util
from future.utils import listitems
import pymongo import pymongo
import six import six
from six import iteritems from six import iteritems
@ -670,7 +671,7 @@ class BaseDocument(object):
del set_data["_id"] del set_data["_id"]
# Determine if any changed items were actually unset. # Determine if any changed items were actually unset.
for path, value in list(set_data.items()): for path, value in listitems(set_data):
if value or isinstance( if value or isinstance(
value, (numbers.Number, bool) value, (numbers.Number, bool)
): # Account for 0 and True that are truthy ): # Account for 0 and True that are truthy