Skip to content

Commit 48e1f15

Browse files
committed
use SAFE_METHODS and make tuple
1 parent 2e55d15 commit 48e1f15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework/permissions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.http import Http404
66
from rest_framework.compat import get_model_name
77

8-
SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS']
8+
SAFE_METHODS = ('GET', 'HEAD', 'OPTIONS')
99

1010

1111
class BasePermission(object):
@@ -185,7 +185,7 @@ def has_object_permission(self, request, view, obj):
185185
# they have read permissions to see 403, or not, and simply see
186186
# a 404 response.
187187

188-
if request.method in ('GET', 'OPTIONS', 'HEAD'):
188+
if request.method in SAFE_METHODS:
189189
# Read permissions already checked and failed, no need
190190
# to make another lookup.
191191
raise Http404

0 commit comments

Comments
 (0)