From 0d4afad342b6412d322c3ef20c61c7b51e9698ef Mon Sep 17 00:00:00 2001 From: Andrei Zbikowski Date: Fri, 24 Jan 2014 16:54:29 -0600 Subject: [PATCH] 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)