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
22ee89f0
Commit
22ee89f0
authored
Jan 28, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up auto-escaping.
parent
bbfa404e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
djangorestframework/templates/renderer.html
+1
-1
djangorestframework/templates/renderer.txt
+2
-2
djangorestframework/views.py
+5
-2
No files found.
djangorestframework/templates/renderer.html
View file @
22ee89f0
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
<div
class=
'content-main'
>
<div
class=
'content-main'
>
<h1>
{{ name }}
</h1>
<h1>
{{ name }}
</h1>
<p>
{
% autoescape off %}{{ description }}{% endautoescape %
}
</p>
<p>
{
{ description }
}
</p>
<div
class=
'module'
>
<div
class=
'module'
>
<pre><b>
{{ response.status }} {{ response.status_text }}
</b>
{% autoescape off %}
<pre><b>
{{ response.status }} {{ response.status_text }}
</b>
{% autoescape off %}
{% for key, val in response.headers.items %}
<b>
{{ key }}:
</b>
{{ val|urlize_quoted_links }}
{% for key, val in response.headers.items %}
<b>
{{ key }}:
</b>
{{ val|urlize_quoted_links }}
...
...
djangorestframework/templates/renderer.txt
View file @
22ee89f0
{{ name }}
{
% autoescape off %}{
{ name }}
{{ description }}
{{ description }}
{% autoescape off %}
HTTP/1.0 {{ response.status }} {{ response.status_text }}
HTTP/1.0 {{ response.status }} {{ response.status_text }}
{% for key, val in response.headers.items %}{{ key }}: {{ val }}
{% for key, val in response.headers.items %}{{ key }}: {{ val }}
{% endfor %}
{% endfor %}
{{ content }}{% endautoescape %}
{{ content }}{% endautoescape %}
djangorestframework/views.py
View file @
22ee89f0
...
@@ -36,6 +36,7 @@ def _remove_trailing_string(content, trailing):
...
@@ -36,6 +36,7 @@ def _remove_trailing_string(content, trailing):
return
content
[:
-
len
(
trailing
)]
return
content
[:
-
len
(
trailing
)]
return
content
return
content
def
_remove_leading_indent
(
content
):
def
_remove_leading_indent
(
content
):
"""
"""
Remove leading indent from a block of text.
Remove leading indent from a block of text.
...
@@ -50,6 +51,7 @@ def _remove_leading_indent(content):
...
@@ -50,6 +51,7 @@ def _remove_leading_indent(content):
return
re
.
sub
(
re
.
compile
(
whitespace_pattern
,
re
.
MULTILINE
),
''
,
content
)
return
re
.
sub
(
re
.
compile
(
whitespace_pattern
,
re
.
MULTILINE
),
''
,
content
)
return
content
return
content
def
_camelcase_to_spaces
(
content
):
def
_camelcase_to_spaces
(
content
):
"""
"""
Translate 'CamelCaseNames' to 'Camel Case Names'.
Translate 'CamelCaseNames' to 'Camel Case Names'.
...
@@ -161,9 +163,10 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
...
@@ -161,9 +163,10 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
def
markup_description
(
self
,
description
):
def
markup_description
(
self
,
description
):
if
apply_markdown
:
if
apply_markdown
:
return
apply_markdown
(
description
)
description
=
apply_markdown
(
description
)
else
:
else
:
return
mark_safe
(
escape
(
description
)
.
replace
(
'
\n
'
,
'<br />'
))
description
=
escape
(
description
)
.
replace
(
'
\n
'
,
'<br />'
)
return
mark_safe
(
description
)
def
http_method_not_allowed
(
self
,
request
,
*
args
,
**
kwargs
):
def
http_method_not_allowed
(
self
,
request
,
*
args
,
**
kwargs
):
"""
"""
...
...
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