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
92b5db59
Commit
92b5db59
authored
Apr 04, 2013
by
glic3rinu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added break_long_headers on templatetags and base template
parent
df30b345
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletions
+12
-1
rest_framework/templates/rest_framework/base.html
+1
-1
rest_framework/templatetags/rest_framework.py
+11
-0
No files found.
rest_framework/templates/rest_framework/base.html
View file @
92b5db59
...
...
@@ -115,7 +115,7 @@
</div>
<div
class=
"response-info"
>
<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 %}
</div>
{{ content|urlize_quoted_links }}
</pre>
{% endautoescape %}
</div>
...
...
rest_framework/templatetags/rest_framework.py
View file @
92b5db59
...
...
@@ -260,3 +260,14 @@ def urlize_quoted_links(text, trim_url_limit=None, nofollow=True, autoescape=Tru
elif
autoescape
:
words
[
i
]
=
escape
(
word
)
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
:
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