Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
48e1f151
Commit
48e1f151
authored
Mar 16, 2015
by
Di Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use SAFE_METHODS and make tuple
parent
2e55d15d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
rest_framework/permissions.py
+2
-2
No files found.
rest_framework/permissions.py
View file @
48e1f151
...
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
...
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
from
django.http
import
Http404
from
django.http
import
Http404
from
rest_framework.compat
import
get_model_name
from
rest_framework.compat
import
get_model_name
SAFE_METHODS
=
[
'GET'
,
'HEAD'
,
'OPTIONS'
]
SAFE_METHODS
=
(
'GET'
,
'HEAD'
,
'OPTIONS'
)
class
BasePermission
(
object
):
class
BasePermission
(
object
):
...
@@ -185,7 +185,7 @@ class DjangoObjectPermissions(DjangoModelPermissions):
...
@@ -185,7 +185,7 @@ class DjangoObjectPermissions(DjangoModelPermissions):
# they have read permissions to see 403, or not, and simply see
# they have read permissions to see 403, or not, and simply see
# a 404 response.
# a 404 response.
if
request
.
method
in
(
'GET'
,
'OPTIONS'
,
'HEAD'
)
:
if
request
.
method
in
SAFE_METHODS
:
# Read permissions already checked and failed, no need
# Read permissions already checked and failed, no need
# to make another lookup.
# to make another lookup.
raise
Http404
raise
Http404
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment