Skip to content

Commit 1150e12

Browse files
author
Cosimo Streppone
committed
delete(): filter() behavior changed from python 2 to 3
1 parent 7ca0dd6 commit 1150e12

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pysolr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ def delete(self, id=None, q=None, commit=True, softCommit=False, waitFlush=None,
926926
if not isinstance(id, (list, set, tuple)):
927927
id = [id]
928928
else:
929-
id = filter(None, id)
929+
id = list(filter(None, id))
930930
if id:
931931
m = '<delete>%s</delete>' % ''.join('<id>%s</id>' % i for i in id)
932932
else:

tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ def test_delete(self):
661661
def leaf_doc(doc):
662662
return 'price' in doc and NESTED_DOC_KEY not in doc
663663

664-
to_delete_docs = filter(leaf_doc, self.docs)
664+
to_delete_docs = list(filter(leaf_doc, self.docs))
665665
to_delete_ids = [doc['id'] for doc in to_delete_docs]
666666

667667
self.solr.add(to_delete_docs)

0 commit comments

Comments
 (0)