improved deprecation documentation and added warning when using snapshot with PyMongo3
This commit is contained in:
parent
76adb13a64
commit
c25619fd63
@ -937,6 +937,7 @@ class BaseQuerySet(object):
|
|||||||
:param enabled: whether or not snapshot mode is enabled
|
:param enabled: whether or not snapshot mode is enabled
|
||||||
|
|
||||||
..versionchanged:: 0.5 - made chainable
|
..versionchanged:: 0.5 - made chainable
|
||||||
|
.. deprecated:: Ignored with PyMongo 3+
|
||||||
"""
|
"""
|
||||||
queryset = self.clone()
|
queryset = self.clone()
|
||||||
queryset._snapshot = enabled
|
queryset._snapshot = enabled
|
||||||
@ -958,6 +959,8 @@ class BaseQuerySet(object):
|
|||||||
"""Enable or disable the slave_okay when querying.
|
"""Enable or disable the slave_okay when querying.
|
||||||
|
|
||||||
:param enabled: whether or not the slave_okay is enabled
|
:param enabled: whether or not the slave_okay is enabled
|
||||||
|
|
||||||
|
.. deprecated:: Ignored with PyMongo 3+
|
||||||
"""
|
"""
|
||||||
queryset = self.clone()
|
queryset = self.clone()
|
||||||
queryset._slave_okay = enabled
|
queryset._slave_okay = enabled
|
||||||
@ -1420,8 +1423,11 @@ class BaseQuerySet(object):
|
|||||||
cursor_args['slave_okay'] = self._slave_okay
|
cursor_args['slave_okay'] = self._slave_okay
|
||||||
else:
|
else:
|
||||||
fields_name = 'projection'
|
fields_name = 'projection'
|
||||||
# snapshot is not to handled at all by PyMongo 3+
|
# snapshot is not handled at all by PyMongo 3+
|
||||||
# TODO: raise a warning?
|
# TODO: evaluate similar possibilities using modifiers
|
||||||
|
if self._snapshot:
|
||||||
|
msg = "The snapshot option is not anymore available with PyMongo 3+"
|
||||||
|
warnings.warn(msg, DeprecationWarning)
|
||||||
cursor_args = {
|
cursor_args = {
|
||||||
'no_cursor_timeout': self._timeout
|
'no_cursor_timeout': self._timeout
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user