Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions mongoengine/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@ def to_mongo(self, *args, **kwargs):

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
Expand Down
18 changes: 0 additions & 18 deletions tests/document/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3189,24 +3189,6 @@ def save(self, *args, **kwargs):
"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():
warnings.simplefilter("error", DeprecationWarning)
with self.assertRaises(DeprecationWarning):
doc.emb.save()

with self.assertRaises(DeprecationWarning):
doc.emb.reload()

def test_embedded_document_equality(self):
class Test(Document):
field = StringField(required=True)
Expand Down