From 99a5f2cd9d5ea4ea84ed8ed421b29cc149cdacdc Mon Sep 17 00:00:00 2001 From: Erdenezul Batmunkh Date: Mon, 19 Jun 2017 05:06:07 +0000 Subject: [PATCH 1/5] EmbeddedDocument should not have save method #1552 --- mongoengine/document.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/mongoengine/document.py b/mongoengine/document.py index f1622934..2efb5c5c 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -88,9 +88,6 @@ class EmbeddedDocument(BaseDocument): return data - def save(self, *args, **kwargs): - self._instance.save(*args, **kwargs) - def reload(self, *args, **kwargs): self._instance.reload(*args, **kwargs) From 9d53ad53e5b8ed526edadd109ea68b9dfc106798 Mon Sep 17 00:00:00 2001 From: Erdenezul Batmunkh Date: Fri, 10 May 2019 17:33:59 +0200 Subject: [PATCH 2/5] Remove save and reload from embeddeddocument --- mongoengine/document.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mongoengine/document.py b/mongoengine/document.py index 57364ae6..4f91401c 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -89,18 +89,6 @@ class EmbeddedDocument(six.with_metaclass(DocumentMetaclass, BaseDocument)): return data - def save(self, *args, **kwargs): - warnings.warn("EmbeddedDocument.save is deprecated and will be removed in a next version of mongoengine." - "Use the parent document's .save() or ._instance.save()", - DeprecationWarning, stacklevel=2) - self._instance.save(*args, **kwargs) - - def reload(self, *args, **kwargs): - warnings.warn("EmbeddedDocument.reload is deprecated and will be removed in a next version of mongoengine." - "Use the parent document's .reload() or ._instance.reload()", - DeprecationWarning, stacklevel=2) - self._instance.reload(*args, **kwargs) - class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)): """The base class used for defining the structure and properties of From 1d29b824a83b46af9a89028fe3df1994c9e66190 Mon Sep 17 00:00:00 2001 From: Erdenezul Batmunkh Date: Tue, 11 Jun 2019 12:52:29 +0200 Subject: [PATCH 3/5] Remove save method from test --- tests/document/instance.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/document/instance.py b/tests/document/instance.py index 0f2f0c0f..e8248c3b 100644 --- a/tests/document/instance.py +++ b/tests/document/instance.py @@ -3200,10 +3200,6 @@ class InstanceTest(MongoDBTestCase): doc = Doc(emb=Embedded()).save() doc.emb.save() # Make sure its still working with warnings.catch_warnings(): - warnings.simplefilter("error", DeprecationWarning) - with self.assertRaises(DeprecationWarning): - doc.emb.save() - with self.assertRaises(DeprecationWarning): doc.emb.reload() From 7ad6f036e793d016b6dbb6bd411a1facc90743c9 Mon Sep 17 00:00:00 2001 From: Erdenezul Batmunkh Date: Tue, 11 Jun 2019 13:16:33 +0200 Subject: [PATCH 4/5] Remove test --- tests/document/instance.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/document/instance.py b/tests/document/instance.py index e8248c3b..b60f5156 100644 --- a/tests/document/instance.py +++ b/tests/document/instance.py @@ -3189,20 +3189,6 @@ class InstanceTest(MongoDBTestCase): "UNDEFINED", system.nodes["node"].parameters["param"].macros["test"].value) - def test_embedded_document_save_reload_warning(self): - """Relates to #1570""" - class Embedded(EmbeddedDocument): - pass - - class Doc(Document): - emb = EmbeddedDocumentField(Embedded) - - doc = Doc(emb=Embedded()).save() - doc.emb.save() # Make sure its still working - with warnings.catch_warnings(): - with self.assertRaises(DeprecationWarning): - doc.emb.reload() - def test_embedded_document_equality(self): class Test(Document): field = StringField(required=True) From c58b9f00f0f0c1093a7a5fceae3ccdb6d0528388 Mon Sep 17 00:00:00 2001 From: Erdenezul Batmunkh Date: Tue, 11 Jun 2019 15:53:50 +0200 Subject: [PATCH 5/5] Add changelog --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9ef90afe..2466d19a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -23,6 +23,7 @@ Development - Calling `connect` 2 times with the same alias and different parameter will raise an error (should call `disconnect` first). - `disconnect` now clears `mongoengine.connection._connection_settings`. - `disconnect` now clears the cached attribute `Document._collection`. +- BREAKING CHANGE: `EmbeddedDocument.save` & `.reload` is no longier exist #1552 - (Fill this out as you fix issues and develop your features). Changes in 0.17.0