Skip to content

Commit 1f02d5f

Browse files
author
erdenezul
authored
Merge pull request #1570 from erdenezul/remove_save_embedded
EmbeddedDocument should not have save method #1552
2 parents f131b18 + c58b9f0 commit 1f02d5f

File tree

3 files changed

+1
-30
lines changed

3 files changed

+1
-30
lines changed

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Development
2323
- Calling `connect` 2 times with the same alias and different parameter will raise an error (should call `disconnect` first).
2424
- `disconnect` now clears `mongoengine.connection._connection_settings`.
2525
- `disconnect` now clears the cached attribute `Document._collection`.
26+
- BREAKING CHANGE: `EmbeddedDocument.save` & `.reload` is no longier exist #1552
2627
- (Fill this out as you fix issues and develop your features).
2728

2829
Changes in 0.17.0

mongoengine/document.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,6 @@ def to_mongo(self, *args, **kwargs):
9090

9191
return data
9292

93-
def save(self, *args, **kwargs):
94-
warnings.warn("EmbeddedDocument.save is deprecated and will be removed in a next version of mongoengine."
95-
"Use the parent document's .save() or ._instance.save()",
96-
DeprecationWarning, stacklevel=2)
97-
self._instance.save(*args, **kwargs)
98-
99-
def reload(self, *args, **kwargs):
100-
warnings.warn("EmbeddedDocument.reload is deprecated and will be removed in a next version of mongoengine."
101-
"Use the parent document's .reload() or ._instance.reload()",
102-
DeprecationWarning, stacklevel=2)
103-
self._instance.reload(*args, **kwargs)
104-
10593

10694
class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)):
10795
"""The base class used for defining the structure and properties of

tests/document/instance.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,24 +3189,6 @@ def save(self, *args, **kwargs):
31893189
"UNDEFINED",
31903190
system.nodes["node"].parameters["param"].macros["test"].value)
31913191

3192-
def test_embedded_document_save_reload_warning(self):
3193-
"""Relates to #1570"""
3194-
class Embedded(EmbeddedDocument):
3195-
pass
3196-
3197-
class Doc(Document):
3198-
emb = EmbeddedDocumentField(Embedded)
3199-
3200-
doc = Doc(emb=Embedded()).save()
3201-
doc.emb.save() # Make sure its still working
3202-
with warnings.catch_warnings():
3203-
warnings.simplefilter("error", DeprecationWarning)
3204-
with self.assertRaises(DeprecationWarning):
3205-
doc.emb.save()
3206-
3207-
with self.assertRaises(DeprecationWarning):
3208-
doc.emb.reload()
3209-
32103192
def test_embedded_document_equality(self):
32113193
class Test(Document):
32123194
field = StringField(required=True)

0 commit comments

Comments
 (0)