Skip to content

Commit

Permalink
user_script error in insideout mode fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ProvoloneStein authored and Suor committed Oct 9, 2024
1 parent 8f0b432 commit 9069063
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cacheops/getset.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ def _conj_cache_key(table, conj):
for conj in disj]

def dnfs_to_schemes(cond_dnfs):
return {table: [",".join(sorted(conj)) for conj in disj]
return {table: list({",".join(sorted(conj)) for conj in disj})
for table, disj in cond_dnfs.items() if disj}
15 changes: 15 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from contextlib import contextmanager
from functools import reduce
import operator
import re
import platform
import unittest
Expand Down Expand Up @@ -718,6 +720,19 @@ def test_430_no_error_raises(self):
# no error raises on delete
media_type.delete()

def test_480(self):
orm_lookups = ['title__icontains', 'category__title__icontains', ]
search_terms = ['1', "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"]
queryset = Post.objects.filter(visible=True)
conditions = []
for search_term in search_terms:
queries = [
models.Q(**{orm_lookup: search_term})
for orm_lookup in orm_lookups
]
conditions.append(reduce(operator.or_, queries))
list(queryset.filter(reduce(operator.and_, conditions)).cache())


class RelatedTests(BaseTestCase):
fixtures = ['basic']
Expand Down

0 comments on commit 9069063

Please sign in to comment.