From c25619fd6314ada89893c97dacd231e57a67e54b Mon Sep 17 00:00:00 2001 From: mrigal Date: Sun, 12 Apr 2015 14:07:45 +0200 Subject: [PATCH] improved deprecation documentation and added warning when using snapshot with PyMongo3 --- mongoengine/queryset/base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mongoengine/queryset/base.py b/mongoengine/queryset/base.py index 803374bd..3752902a 100644 --- a/mongoengine/queryset/base.py +++ b/mongoengine/queryset/base.py @@ -937,6 +937,7 @@ class BaseQuerySet(object): :param enabled: whether or not snapshot mode is enabled ..versionchanged:: 0.5 - made chainable + .. deprecated:: Ignored with PyMongo 3+ """ queryset = self.clone() queryset._snapshot = enabled @@ -958,6 +959,8 @@ class BaseQuerySet(object): """Enable or disable the slave_okay when querying. :param enabled: whether or not the slave_okay is enabled + + .. deprecated:: Ignored with PyMongo 3+ """ queryset = self.clone() queryset._slave_okay = enabled @@ -1420,8 +1423,11 @@ class BaseQuerySet(object): cursor_args['slave_okay'] = self._slave_okay else: fields_name = 'projection' - # snapshot is not to handled at all by PyMongo 3+ - # TODO: raise a warning? + # snapshot is not handled at all by PyMongo 3+ + # 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 = { 'no_cursor_timeout': self._timeout }