Skip to content

Commit 9069063

Browse files
ProvoloneSteinSuor
authored andcommitted
user_script error in insideout mode fix
1 parent 8f0b432 commit 9069063

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

cacheops/getset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ def _conj_cache_key(table, conj):
142142
for conj in disj]
143143

144144
def dnfs_to_schemes(cond_dnfs):
145-
return {table: [",".join(sorted(conj)) for conj in disj]
145+
return {table: list({",".join(sorted(conj)) for conj in disj})
146146
for table, disj in cond_dnfs.items() if disj}

tests/tests.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from contextlib import contextmanager
2+
from functools import reduce
3+
import operator
24
import re
35
import platform
46
import unittest
@@ -718,6 +720,19 @@ def test_430_no_error_raises(self):
718720
# no error raises on delete
719721
media_type.delete()
720722

723+
def test_480(self):
724+
orm_lookups = ['title__icontains', 'category__title__icontains', ]
725+
search_terms = ['1', "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"]
726+
queryset = Post.objects.filter(visible=True)
727+
conditions = []
728+
for search_term in search_terms:
729+
queries = [
730+
models.Q(**{orm_lookup: search_term})
731+
for orm_lookup in orm_lookups
732+
]
733+
conditions.append(reduce(operator.or_, queries))
734+
list(queryset.filter(reduce(operator.and_, conditions)).cache())
735+
721736

722737
class RelatedTests(BaseTestCase):
723738
fixtures = ['basic']

0 commit comments

Comments
 (0)