Fixed amibiguity and differing behaviour regarding field defaults (#349)

Now field defaults are king, unsetting or setting to None on a field
with a default means the default is reapplied.
This commit is contained in:
Ross Lawley
2013-06-06 13:31:52 +00:00
parent ea53612822
commit ad15781d8f
7 changed files with 160 additions and 33 deletions

View File

@@ -348,7 +348,7 @@ class QuerySet(object):
"""
Document = _import_class('Document')
if not write_concern:
if write_concern is None:
write_concern = {}
docs = doc_or_docs
@@ -424,7 +424,7 @@ class QuerySet(object):
queryset = self.clone()
doc = queryset._document
if not write_concern:
if write_concern is None:
write_concern = {}
# Handle deletes where skips or limits have been applied or
@@ -490,7 +490,7 @@ class QuerySet(object):
if not update and not upsert:
raise OperationError("No update parameters, would remove data")
if not write_concern:
if write_concern is None:
write_concern = {}
queryset = self.clone()