From 0d4afad342b6412d322c3ef20c61c7b51e9698ef Mon Sep 17 00:00:00 2001 From: Andrei Zbikowski Date: Fri, 24 Jan 2014 16:54:29 -0600 Subject: [PATCH 1/2] Fixes issue with recursive embedded document errors --- mongoengine/base/document.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoengine/base/document.py b/mongoengine/base/document.py index f5eae8ff..c625f8b8 100644 --- a/mongoengine/base/document.py +++ b/mongoengine/base/document.py @@ -317,7 +317,7 @@ class BaseDocument(object): pk = "None" if hasattr(self, 'pk'): pk = self.pk - elif self._instance: + elif self._instance and hasattr(self._instance, 'pk'): pk = self._instance.pk message = "ValidationError (%s:%s) " % (self._class_name, pk) raise ValidationError(message, errors=errors) From 5d9ec0b20854eac476f974b495a1d444c7134bf8 Mon Sep 17 00:00:00 2001 From: Nicolas Despres Date: Mon, 17 Mar 2014 17:19:17 +0100 Subject: [PATCH 2/2] Save is called on the document not the file field. --- docs/guide/gridfs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/gridfs.rst b/docs/guide/gridfs.rst index 596585de..68e7a6d2 100644 --- a/docs/guide/gridfs.rst +++ b/docs/guide/gridfs.rst @@ -46,7 +46,7 @@ slightly different manner. First, a new file must be created by calling the marmot.photo.write('some_more_image_data') marmot.photo.close() - marmot.photo.save() + marmot.save() Deletion --------