mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
Tidy up auto-escaping.
This commit is contained in:
parent
bbfa404e46
commit
22ee89f0f3
|
@ -50,7 +50,7 @@
|
|||
|
||||
<div class='content-main'>
|
||||
<h1>{{ name }}</h1>
|
||||
<p>{% autoescape off %}{{ description }}{% endautoescape %}</p>
|
||||
<p>{{ description }}</p>
|
||||
<div class='module'>
|
||||
<pre><b>{{ response.status }} {{ response.status_text }}</b>{% autoescape off %}
|
||||
{% for key, val in response.headers.items %}<b>{{ key }}:</b> {{ val|urlize_quoted_links }}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{{ name }}
|
||||
{% autoescape off %}{{ name }}
|
||||
|
||||
{{ 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 }}
|
||||
{% endfor %}
|
||||
{{ content }}{% endautoescape %}
|
||||
|
|
|
@ -36,6 +36,7 @@ def _remove_trailing_string(content, trailing):
|
|||
return content[:-len(trailing)]
|
||||
return content
|
||||
|
||||
|
||||
def _remove_leading_indent(content):
|
||||
"""
|
||||
Remove leading indent from a block of text.
|
||||
|
@ -50,6 +51,7 @@ def _remove_leading_indent(content):
|
|||
return re.sub(re.compile(whitespace_pattern, re.MULTILINE), '', content)
|
||||
return content
|
||||
|
||||
|
||||
def _camelcase_to_spaces(content):
|
||||
"""
|
||||
Translate 'CamelCaseNames' to 'Camel Case Names'.
|
||||
|
@ -161,9 +163,10 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
|
|||
|
||||
def markup_description(self, description):
|
||||
if apply_markdown:
|
||||
return apply_markdown(description)
|
||||
description = apply_markdown(description)
|
||||
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):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user