Skip to content

Commit 6e00070

Browse files
authored
Merge pull request #34 from miki725/plain
Plain backend returning list
2 parents 8b031cf + 603b786 commit 6e00070

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

HISTORY.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
History
44
-------
55

6+
0.3.2 (2017-05-19)
7+
~~~~~~~~~~~~~~~~~~
8+
9+
* Fixed plain backend to return list in Python 3 vs ``filter()`` generator
10+
which is not compatible with Django pagination since it requires ``len()``
11+
to be implemented.
12+
613
0.3.1 (2017-05-18)
714
~~~~~~~~~~~~~~~~~~
815

tests/backends/test_plain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def _test_filter(self, spec, expected):
8282
backend = PlainFilterBackend(DATA)
8383
backend.bind([spec])
8484

85-
assert list(backend.filter()) == expected
85+
assert backend.filter() == expected
8686

8787
def test_filter_contains(self):
8888
self._test_filter(

url_filter/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
__author__ = 'Miroslav Shubernetskiy'
66
__email__ = '[email protected]'
7-
__version__ = '0.3.1'
7+
__version__ = '0.3.2'

url_filter/backends/plain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def filter_by_specs(self, queryset):
6666
if not self.regular_specs:
6767
return queryset
6868

69-
return filter(self._filter_callable, queryset)
69+
return list(filter(self._filter_callable, queryset))
7070

7171
def _filter_callable(self, item):
7272
return all(self._filter_by_spec(item, spec) for spec in self.regular_specs)

0 commit comments

Comments
 (0)