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
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Changes in 1.0.0
- Fix use of $geoNear or $collStats in aggregate #2493
- BREAKING CHANGE: Further to the deprecation warning, remove ability to use an unpacked list to `Queryset.aggregate(*pipeline)`, a plain list must be provided instead `Queryset.aggregate(pipeline)`, as it's closer to pymongo interface
- BREAKING CHANGE: Further to the deprecation warning, remove `full_response` from `QuerySet.modify` as it wasn't supported with Pymongo 3+
- BREAKING CHANGE: Remove the deprecated ``Q.empty`` and ``QNode.empty``
properties. Use ``not query`` instead (or ``bool(query)`` for the inverse).
- 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
Expand Down
21 changes: 0 additions & 21 deletions mongoengine/queryset/visitor.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import copy
import warnings

from mongoengine.errors import InvalidQueryError
from mongoengine.queryset import transform

__all__ = ("Q", "QNode")


def warn_empty_is_deprecated():
msg = "'empty' property is deprecated in favour of using 'not bool(filter)'"
warnings.warn(msg, DeprecationWarning, stacklevel=2)


class QNodeVisitor:
"""Base visitor class for visiting Q-object nodes in a query tree."""

Expand Down Expand Up @@ -108,11 +102,6 @@ def _combine(self, other, operation):

return QCombination(operation, [self, other])

@property
def empty(self):
warn_empty_is_deprecated()
return False

def __or__(self, other):
return self._combine(other, self.OR)

Expand Down Expand Up @@ -150,11 +139,6 @@ def accept(self, visitor):

return visitor.visit_combination(self)

@property
def empty(self):
warn_empty_is_deprecated()
return not bool(self.children)

def __eq__(self, other):
return (
self.__class__ == other.__class__
Expand Down Expand Up @@ -182,8 +166,3 @@ def __eq__(self, other):

def accept(self, visitor):
return visitor.visit_query(self)

@property
def empty(self):
warn_empty_is_deprecated()
return not bool(self.query)