The test cases I added in PR #115 demonstrate this behaviour. Here's the output of the unit tests running Django 1.7, 1.8, and 1.9. Only the first test setup (locmem_settings
) is shown for brevity.
$ pip install -q django==1.7.11
$ python run_tests.py
Running tests for: locmem_settings
nosetests --verbosity=1
Creating test database for alias 'default'...
Creating test database for alias 'master2'...
....................S.............................
----------------------------------------------------------------------
Ran 50 tests in 1.645s
OK (SKIP=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'master2'...
$ pip install -q django==1.8.9
$ python run_tests.py
Running tests for: locmem_settings
nosetests --verbosity=1
Creating test database for alias 'default'...
Creating test database for alias 'master2'...
....................S.............................
----------------------------------------------------------------------
Ran 50 tests in 0.900s
OK (SKIP=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'master2'...
$ pip install -q django==1.9.2
$ python run_tests.py
Running tests for: locmem_settings
nosetests --verbosity=1
Creating test database for alias 'default'...
Creating test database for alias 'master2'...
....................S.............EE..............
======================================================================
ERROR: test_no_cache_values (tests.test_cache.CachingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/repos/django-cache-machine/tests/test_cache.py", line 567, in test_no_cache_values
result = list(Addon.objects.filter(val__gt=130).values('val', 'author1'))
File "/home/tim/repos/django-cache-machine/ve2/local/lib/python2.7/site-packages/django/db/models/query.py", line 258, in __iter__
self._fetch_all()
File "/home/tim/repos/django-cache-machine/ve2/local/lib/python2.7/site-packages/django/db/models/query.py", line 1074, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/tim/repos/django-cache-machine/caching/base.py", line 114, in __iter__
obj.from_cache = False
AttributeError: 'dict' object has no attribute 'from_cache'
-------------------- >> begin captured logging << --------------------
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:7:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:f8e6ed0ba783d44d957651a900d19f71'])
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:8:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:a91db8631bbb1c6e774f50c9b1402a86'])
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.addon:6:default', u'o:testapp.user:7:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:f8e6ed0ba783d44d957651a900d19f71', ':flush:85031e20aaa9a988dd8025d209b90565'])
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:8:default', u'o:testapp.addon:7:default', u'o:testapp.user:7:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:58f67a49fbe9ba0710be353b033086aa', ':flush:f8e6ed0ba783d44d957651a900d19f71', ':flush:a91db8631bbb1c6e774f50c9b1402a86'])
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:8:default', u'o:testapp.addon:8:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:2e31847edde14c9ede08eb7b280d3a5b', ':flush:a91db8631bbb1c6e774f50c9b1402a86'])
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_no_cache_values_list (tests.test_cache.CachingTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/repos/django-cache-machine/tests/test_cache.py", line 580, in test_no_cache_values_list
result = list(Addon.objects.filter(val__gt=130).values_list('val', 'author1'))
File "/home/tim/repos/django-cache-machine/ve2/local/lib/python2.7/site-packages/django/db/models/query.py", line 258, in __iter__
self._fetch_all()
File "/home/tim/repos/django-cache-machine/ve2/local/lib/python2.7/site-packages/django/db/models/query.py", line 1074, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/tim/repos/django-cache-machine/caching/base.py", line 114, in __iter__
obj.from_cache = False
AttributeError: 'tuple' object has no attribute 'from_cache'
-------------------- >> begin captured logging << --------------------
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:9:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:d283a2e5956cc2bea6bf68bfa0bcb73b'])
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:10:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:818a832060799c3a553eacb0b87bdd0a'])
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:9:default', u'o:testapp.addon:9:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:5012189813f2036adefa54f9e636c9b9', ':flush:d283a2e5956cc2bea6bf68bfa0bcb73b'])
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:10:default', u'o:testapp.user:9:default', u'o:testapp.addon:10:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:3fd60669f1fc41bdbb2034882750b7a3', ':flush:818a832060799c3a553eacb0b87bdd0a', ':flush:d283a2e5956cc2bea6bf68bfa0bcb73b'])
caching.invalidation: DEBUG: in expand_flush_lists
caching.invalidation: DEBUG: deleting object keys: set([u'o:testapp.user:10:default', u'o:testapp.addon:11:default'])
caching.invalidation: DEBUG: clearing flush lists: set([':flush:818a832060799c3a553eacb0b87bdd0a', ':flush:2e12aac9cc4290d47a0e3eba675bab90'])
--------------------- >> end captured logging << ---------------------
----------------------------------------------------------------------
Ran 50 tests in 1.052s
FAILED (SKIP=1, errors=2)
Destroying test database for alias 'default'...
Destroying test database for alias 'master2'...
Upon an initial investigation, this appears to be caused by the fact that QuerySet
no longer calls self._clone
directly.