Fixes cascading saves with filefields

fixes #24 #25
This commit is contained in:
Ross Lawley
2012-06-18 16:45:14 +01:00
parent e4bc92235d
commit 89a6eee6af
3 changed files with 14 additions and 3 deletions

View File

@@ -1335,7 +1335,7 @@ class DocumentTest(unittest.TestCase):
class Foo(Document):
name = StringField()
file = FileField()
picture = FileField()
bar = ReferenceField('self')
Foo.drop_collection()
@@ -1344,7 +1344,7 @@ class DocumentTest(unittest.TestCase):
a.save()
a.bar = a
a.file = open(TEST_IMAGE_PATH, 'rb')
a.picture = open(TEST_IMAGE_PATH, 'rb')
a.save()
# Confirm can save and it resets the changed fields without hitting
@@ -1353,7 +1353,7 @@ class DocumentTest(unittest.TestCase):
b.name='world'
b.save()
self.assertEquals(b.file, b.bar.file, b.bar.bar.file)
self.assertEquals(b.picture, b.bar.picture, b.bar.bar.picture)
def test_save_cascades(self):