Skip to content

Commit 9c9d2bd

Browse files
author
Dmitry Marychev
committed
avoid unnecessary cache invalidation of a django queryset
1 parent edeb606 commit 9c9d2bd

File tree

6 files changed

+5
-9
lines changed

6 files changed

+5
-9
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
max-parallel: 2
1717
matrix:
1818
include:
19-
- python-version: "2.7"
20-
toxenv: py27-django{1.10,1.11}
2119
- python-version: "3.6"
2220
toxenv: py36-django{1.10,1.11,2.0,2.1,2.2,3.0}
2321
- python-version: "3.7"

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
language: python
22
matrix:
33
include:
4-
- python: 2.7
5-
env: TOXENV="py27--django{1.11},flake8"
64
- python: 3.6
75
env: TOXENV="py36--django{1.11,2.0,2.1,2.2,3.0}"
86
- python: 3.7

access_tastypie/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.0b1"
1+
__version__ = "0.1.0b2"

access_tastypie/authorization.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ def read_detail(self, object_list, bundle):
2525
if self.check_able('visible', object_list.model, bundle.request) is False:
2626
return False
2727
if bundle.obj and bundle.obj.pk:
28-
return bool(self.apply_able('visible', object_list.filter(pk=bundle.obj.pk), bundle.request))
28+
# Read_detail() will always receive a queryset with a single object, no need
29+
# to filter it once again. This preserves any cache inside object_list.
30+
return bool(self.apply_able('visible', object_list, bundle.request))
2931
return True
3032

3133
def update_list(self, object_list, bundle):

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@
7474

7575
# Specify the Python versions you support here. In particular, ensure
7676
# that you indicate whether you support Python 2, Python 3 or both.
77-
'Programming Language :: Python :: 2',
78-
'Programming Language :: Python :: 2.7',
7977
'Programming Language :: Python :: 3',
8078
'Programming Language :: Python :: 3.6',
8179
'Programming Language :: Python :: 3.7',

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ deps=
2525
django3.2: django>=3.2,<3.3
2626
django4.0: django>=4.0,<4.1
2727
django4.1: django>=4.1,<4.2
28-
django4.2: django
28+
django4.2: django>=4.2,<4.3
2929
mock
3030

3131
[testenv:flake8]

0 commit comments

Comments
 (0)