Merge pull request #879 from DavidBord/fix-866

Fix #866:  does not follow
This commit is contained in:
David Bordeynik 2015-02-16 15:49:06 +02:00
commit aca8899c4d
3 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,7 @@ Changelog
Changes in 0.9.X - DEV
======================
- `BaseDict` does not follow `setdefault` #866
- Add support for $type operator # 766
- Fix tests for pymongo 2.8+ #877
- No module named 'django.utils.importlib' (Django dev) #872

View File

@ -75,6 +75,10 @@ class BaseDict(dict):
self._mark_as_changed()
return super(BaseDict, self).popitem(*args, **kwargs)
def setdefault(self, *args, **kwargs):
self._mark_as_changed()
return super(BaseDict, self).setdefault(*args, **kwargs)
def update(self, *args, **kwargs):
self._mark_as_changed()
return super(BaseDict, self).update(*args, **kwargs)

View File

@ -1176,6 +1176,11 @@ class FieldTest(unittest.TestCase):
post.reload()
self.assertEqual('updated', post.info['title'])
post.info.setdefault('authors', [])
post.save()
post.reload()
self.assertEqual([], post.info['authors'])
BlogPost.drop_collection()
def test_dictfield_strict(self):