Skip to content

Commit 78c9e97

Browse files
committed
fix linting + update changelog & contributors
1 parent 38ebb5a commit 78c9e97

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,4 @@ that much better:
256256
* Eric Timmons (https://github.com/daewok)
257257
* Matthew Simpson (https://github.com/mcsimps2)
258258
* Leonardo Domingues (https://github.com/leodmgs)
259+
* Agustin Barto (https://github.com/abarto)

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Development
2121
- ``Queryset._ensure_indexes`` and ``Queryset.ensure_indexes``, the right method to use is ``Document.ensure_indexes``
2222
- Added pre-commit #2212
2323
- Renamed requirements-lint.txt to requirements-dev.txt #2212
24+
- Support for setting ReadConcern #2255
2425

2526
Changes in 0.19.1
2627
=================

mongoengine/context_managers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from contextlib import contextmanager
22

3-
from pymongo.write_concern import WriteConcern
43
from pymongo.read_concern import ReadConcern
4+
from pymongo.write_concern import WriteConcern
55

66
from mongoengine.common import _import_class
77
from mongoengine.connection import DEFAULT_CONNECTION_NAME, get_db
@@ -268,11 +268,11 @@ def set_read_write_concern(collection, write_concerns, read_concerns):
268268
combined_write_concerns.update(write_concerns)
269269

270270
combined_read_concerns = dict(collection.read_concern.document.items())
271-
271+
272272
if read_concerns is not None:
273273
combined_read_concerns.update(read_concerns)
274274

275275
yield collection.with_options(
276276
write_concern=WriteConcern(**combined_write_concerns),
277-
read_concern=ReadConcern(**combined_read_concerns)
277+
read_concern=ReadConcern(**combined_read_concerns),
278278
)

mongoengine/queryset/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,9 @@ def read_concern(self, read_concern):
12061206
raise TypeError("%r is not a valid read concern." % (read_concern,))
12071207

12081208
queryset = self.clone()
1209-
queryset._read_concern = ReadConcern(**read_concern) if read_concern is not None else None
1209+
queryset._read_concern = (
1210+
ReadConcern(**read_concern) if read_concern is not None else None
1211+
)
12101212
queryset._cursor_obj = None # we need to re-create the cursor object whenever we apply read_concern
12111213
return queryset
12121214

tests/test_context_managers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
no_dereference,
99
no_sub_classes,
1010
query_counter,
11+
set_read_write_concern,
12+
set_write_concern,
1113
switch_collection,
1214
switch_db,
13-
set_write_concern,
14-
set_read_write_concern,
1515
)
1616
from mongoengine.pymongo_support import count_documents
1717

0 commit comments

Comments
 (0)