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
089887d5
Commit
089887d5
authored
Jul 16, 2017
by
Erick Delfin
Committed by
Tom Christie
Jul 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified chained comparisons and minor code fixes (#5276)
parent
2a1fd3b4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
rest_framework/pagination.py
+2
-2
rest_framework/status.py
+5
-5
rest_framework/utils/formatting.py
+2
-2
No files found.
rest_framework/pagination.py
View file @
089887d5
...
@@ -31,7 +31,7 @@ def _positive_int(integer_string, strict=False, cutoff=None):
...
@@ -31,7 +31,7 @@ def _positive_int(integer_string, strict=False, cutoff=None):
if
ret
<
0
or
(
ret
==
0
and
strict
):
if
ret
<
0
or
(
ret
==
0
and
strict
):
raise
ValueError
()
raise
ValueError
()
if
cutoff
:
if
cutoff
:
ret
=
min
(
ret
,
cutoff
)
ret
urn
min
(
ret
,
cutoff
)
return
ret
return
ret
...
@@ -95,7 +95,7 @@ def _get_displayed_page_numbers(current, final):
...
@@ -95,7 +95,7 @@ def _get_displayed_page_numbers(current, final):
# Now sort the page numbers and drop anything outside the limits.
# Now sort the page numbers and drop anything outside the limits.
included
=
[
included
=
[
idx
for
idx
in
sorted
(
list
(
included
))
idx
for
idx
in
sorted
(
list
(
included
))
if
idx
>
0
and
idx
<=
final
if
0
<
idx
<=
final
]
]
# Finally insert any `...` breaks
# Finally insert any `...` breaks
...
...
rest_framework/status.py
View file @
089887d5
...
@@ -9,23 +9,23 @@ from __future__ import unicode_literals
...
@@ -9,23 +9,23 @@ from __future__ import unicode_literals
def
is_informational
(
code
):
def
is_informational
(
code
):
return
code
>=
100
and
code
<=
199
return
100
<=
code
<=
199
def
is_success
(
code
):
def
is_success
(
code
):
return
code
>=
200
and
code
<=
299
return
200
<=
code
<=
299
def
is_redirect
(
code
):
def
is_redirect
(
code
):
return
code
>=
300
and
code
<=
399
return
300
<=
code
<=
399
def
is_client_error
(
code
):
def
is_client_error
(
code
):
return
code
>=
400
and
code
<=
499
return
400
<=
code
<=
499
def
is_server_error
(
code
):
def
is_server_error
(
code
):
return
code
>=
500
and
code
<=
599
return
500
<=
code
<=
599
HTTP_100_CONTINUE
=
100
HTTP_100_CONTINUE
=
100
...
...
rest_framework/utils/formatting.py
View file @
089887d5
...
@@ -52,8 +52,8 @@ def camelcase_to_spaces(content):
...
@@ -52,8 +52,8 @@ def camelcase_to_spaces(content):
Translate 'CamelCaseNames' to 'Camel Case Names'.
Translate 'CamelCaseNames' to 'Camel Case Names'.
Used when generating names from view classes.
Used when generating names from view classes.
"""
"""
camelcase_boundry
=
'(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))'
camelcase_bound
a
ry
=
'(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))'
content
=
re
.
sub
(
camelcase_boundry
,
'
\\
1'
,
content
)
.
strip
()
content
=
re
.
sub
(
camelcase_bound
a
ry
,
'
\\
1'
,
content
)
.
strip
()
return
' '
.
join
(
content
.
split
(
'_'
))
.
title
()
return
' '
.
join
(
content
.
split
(
'_'
))
.
title
()
...
...
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