1. Marat Khabibullin
  2. wtforms

Commits

Marat Khabibullin  committed 8c852f5

fix bug in saving document with no changes

  • Participants
  • Parent commits 496658c
  • Branches default

Comments (0)

Files changed (2)

File wtforms/ext/mongoengine/document_update.py

View file
     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,

File wtforms/ext/mongoengine/models.py

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