Never return soft-deleted items in /latest/{assets,comments}
This commit is contained in:
parent
5b2d7447e6
commit
77184bbad0
@ -11,10 +11,14 @@ blueprint = Blueprint('latest', __name__)
|
|||||||
def keep_fetching(collection, db_filter, projection, sort, py_filter, batch_size=12):
|
def keep_fetching(collection, db_filter, projection, sort, py_filter, batch_size=12):
|
||||||
"""Yields results for which py_filter returns True"""
|
"""Yields results for which py_filter returns True"""
|
||||||
|
|
||||||
|
projection['_deleted'] = 1
|
||||||
curs = collection.find(db_filter, projection).sort(sort)
|
curs = collection.find(db_filter, projection).sort(sort)
|
||||||
curs.batch_size(batch_size)
|
curs.batch_size(batch_size)
|
||||||
|
|
||||||
for doc in curs:
|
for doc in curs:
|
||||||
|
if doc.get('_deleted'):
|
||||||
|
continue
|
||||||
|
doc.pop('_deleted', None)
|
||||||
if py_filter(doc):
|
if py_filter(doc):
|
||||||
yield doc
|
yield doc
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user