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 @@ -29,6 +29,7 @@ Changes in 1.0.0
- Fixed stacklevel of many warnings (to point places emitting the warning more accurately)
- Add support for collation/hint/comment to delete/update and aggregate #2842
- BREAKING CHANGE: Remove LongField as it's equivalent to IntField since we drop support to Python2 long time ago (User should simply switch to IntField) #2309
- BREAKING CHANGE: The obsolete ``slaves`` and ``is_slave`` connection options were silently ignored since 2014 and will now raise ``ConnectionFailure`` if provided #2920.
- BugFix - Calling .clear on a ListField wasn't being marked as changed (and flushed to db upon .save()) #2858
- Improve error message in case a document assigned to a ReferenceField wasn't saved yet #1955
- BugFix - Take `where()` into account when using `.modify()`, as in MyDocument.objects().where("this[field] >= this[otherfield]").modify(field='new') #2044
Expand Down
4 changes: 0 additions & 4 deletions mongoengine/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,6 @@ def _get_connection_settings(
resolved_hosts.append(entity)
conn_settings["host"] = resolved_hosts

# Deprecated parameters that should not be passed on
kwargs.pop("slaves", None)
kwargs.pop("is_slave", None)

keys = {
key.lower() for key in kwargs.keys()
} # pymongo options are case insensitive
Expand Down
11 changes: 11 additions & 0 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ def test_connect_fails_if_connect_2_times_with_custom_alias(self):
== str(exc_info.value)
)

def test_connect__obsolete_slave_options__raises_connection_failure(self):
obsolete_options = ({"slaves": []}, {"is_slave": True})

for options in obsolete_options:
option_name = next(iter(options))
with self.subTest(options=options), pytest.raises(
ConnectionFailure
) as exc_info:
connect(alias=random_str(), **options)
assert option_name in str(exc_info.value)

def test_connect_fails_if_similar_connection_settings_arent_defined_the_same_way(
self,
):
Expand Down