Commits

Marat Khabibullin committed 8c852f5

fix bug in saving document with no changes

Comments (0)

Files changed (2)

wtforms/ext/mongoengine/document_update.py

     Update method that updates current instance in memory and make
     query to MongoDb.
     '''
+    if not kwargs:
+        return 0
     transforms = {
         'set': lambda o, n: n,
         'unset': lambda o, n: None,

wtforms/ext/mongoengine/models.py

                                     % (type(self.instance),
                                       name,
                                       type(self)))
+            if not update:
+                # Nothing is changed
+                return self.instance
             update['commit'] = commit
             self.instance.update(**update)
         else: