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
5b56639e
Commit
5b56639e
authored
Apr 04, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #777 from glic3rinu/master
Break long headers on the browsable API
parents
df30b345
77ac2044
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletions
+13
-1
docs/topics/release-notes.md
+1
-0
rest_framework/templates/rest_framework/base.html
+1
-1
rest_framework/templatetags/rest_framework.py
+11
-0
No files found.
docs/topics/release-notes.md
View file @
5b56639e
...
@@ -44,6 +44,7 @@ You can determine your currently installed version using `pip freeze`:
...
@@ -44,6 +44,7 @@ You can determine your currently installed version using `pip freeze`:
*
OAuth2 authentication no longer requires unneccessary URL parameters in addition to the token.
*
OAuth2 authentication no longer requires unneccessary URL parameters in addition to the token.
*
URL hyperlinking in browseable API now handles more cases correctly.
*
URL hyperlinking in browseable API now handles more cases correctly.
*
Long HTTP headers in browsable API are broken in multiple lines when possible.
*
Bugfix
:
Fix regression with DjangoFilterBackend not worthing correctly with single object views.
*
Bugfix
:
Fix regression with DjangoFilterBackend not worthing correctly with single object views.
*
Bugfix
:
OAuth should fail hard when invalid token used.
*
Bugfix
:
OAuth should fail hard when invalid token used.
*
Bugfix
:
Fix serializer potentially returning `None` object for models that define `__bool__` or `__len__`.
*
Bugfix
:
Fix serializer potentially returning `None` object for models that define `__bool__` or `__len__`.
...
...
rest_framework/templates/rest_framework/base.html
View file @
5b56639e
...
@@ -115,7 +115,7 @@
...
@@ -115,7 +115,7 @@
</div>
</div>
<div
class=
"response-info"
>
<div
class=
"response-info"
>
<pre
class=
"prettyprint"
><div
class=
"meta nocode"
><b>
HTTP {{ response.status_code }} {{ response.status_text }}
</b>
{% autoescape off %}
<pre
class=
"prettyprint"
><div
class=
"meta nocode"
><b>
HTTP {{ response.status_code }} {{ response.status_text }}
</b>
{% autoescape off %}
{% for key, val in response.items %}
<b>
{{ key }}:
</b>
<span
class=
"lit"
>
{{ val|urlize_quoted_links }}
</span>
{% for key, val in response.items %}
<b>
{{ key }}:
</b>
<span
class=
"lit"
>
{{ val|
break_long_headers|
urlize_quoted_links }}
</span>
{% endfor %}
{% endfor %}
</div>
{{ content|urlize_quoted_links }}
</pre>
{% endautoescape %}
</div>
{{ content|urlize_quoted_links }}
</pre>
{% endautoescape %}
</div>
</div>
...
...
rest_framework/templatetags/rest_framework.py
View file @
5b56639e
...
@@ -260,3 +260,14 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru
...
@@ -260,3 +260,14 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru
elif
autoescape
:
elif
autoescape
:
words
[
i
]
=
escape
(
word
)
words
[
i
]
=
escape
(
word
)
return
''
.
join
(
words
)
return
''
.
join
(
words
)
@register.filter
def
break_long_headers
(
header
):
"""
Breaks headers longer than 160 characters (~page length)
when possible (are comma separated)
"""
if
len
(
header
)
>
160
and
','
in
header
:
header
=
mark_safe
(
'<br> '
+
', <br>'
.
join
(
header
.
split
(
','
)))
return
header
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