Added q_objs to __call__ args
This commit is contained in:
parent
b375c41586
commit
1818cf7114
@ -149,9 +149,10 @@ class QuerySet(object):
|
|||||||
|
|
||||||
def __call__(self, *q_objs, **query):
|
def __call__(self, *q_objs, **query):
|
||||||
"""Filter the selected documents by calling the
|
"""Filter the selected documents by calling the
|
||||||
:class:`~mongoengine.QuerySet` with a query.
|
:class:`~mongoengine.queryset.QuerySet` with a query.
|
||||||
|
|
||||||
:param q_objs: :class:`~mongoengine.Q` objects to be used in the query
|
:param q_objs: :class:`~mongoengine.queryset.Q` objects to be used in
|
||||||
|
the query
|
||||||
:param query: Django-style query keyword arguments
|
:param query: Django-style query keyword arguments
|
||||||
"""
|
"""
|
||||||
for q in q_objs:
|
for q in q_objs:
|
||||||
@ -161,7 +162,9 @@ class QuerySet(object):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def filter(self, *q_objs, **query):
|
def filter(self, *q_objs, **query):
|
||||||
return self.__call__(**query)
|
"""An alias of :meth:`~mongoengine.queryset.QuerySet.__call__`
|
||||||
|
"""
|
||||||
|
return self.__call__(*q_objs, **query)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _collection(self):
|
def _collection(self):
|
||||||
@ -327,7 +330,16 @@ class QuerySet(object):
|
|||||||
"""
|
"""
|
||||||
# Slice provided
|
# Slice provided
|
||||||
if isinstance(key, slice):
|
if isinstance(key, slice):
|
||||||
|
try:
|
||||||
self._cursor_obj = self._cursor[key]
|
self._cursor_obj = self._cursor[key]
|
||||||
|
except IndexError, err:
|
||||||
|
# PyMongo raises an error if key.start == key.stop, catch it,
|
||||||
|
# bin it, kill it.
|
||||||
|
if key.start >=0 and key.stop >= 0 and key.step is None:
|
||||||
|
if key.start == key.stop:
|
||||||
|
self.limit(0)
|
||||||
|
return self
|
||||||
|
raise err
|
||||||
# Allow further QuerySet modifications to be performed
|
# Allow further QuerySet modifications to be performed
|
||||||
return self
|
return self
|
||||||
# Integer index provided
|
# Integer index provided
|
||||||
|
Loading…
x
Reference in New Issue
Block a user