aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/utils/formatting.py
diff options
context:
space:
mode:
authorPaul Oswald2014-07-28 16:59:55 +0900
committerPaul Oswald2014-07-28 16:59:55 +0900
commit921e4ed2ee11edffd19d2ca40f10d47d2c148ea1 (patch)
treed6a331ba11ddf1d4faad0dbb655219ea8fca781a /rest_framework/utils/formatting.py
parentc7a988eb38b96926156f01c2b6f2603a4ef41ecf (diff)
downloaddjango-rest-framework-921e4ed2ee11edffd19d2ca40f10d47d2c148ea1.tar.bz2
Evaluate content before passing to regex.sub
Issue #1708
Diffstat (limited to 'rest_framework/utils/formatting.py')
-rw-r--r--rest_framework/utils/formatting.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/rest_framework/utils/formatting.py b/rest_framework/utils/formatting.py
index 4b59ba84..12b79b6c 100644
--- a/rest_framework/utils/formatting.py
+++ b/rest_framework/utils/formatting.py
@@ -6,8 +6,6 @@ from __future__ import unicode_literals
from django.utils.html import escape
from django.utils.safestring import mark_safe
from rest_framework.compat import apply_markdown
-from rest_framework.settings import api_settings
-from textwrap import dedent
import re
@@ -36,7 +34,7 @@ def dedent(content):
# unindent the content if needed
if whitespace_counts:
whitespace_pattern = '^' + (' ' * min(whitespace_counts))
- content = re.sub(re.compile(whitespace_pattern, re.MULTILINE), '', content)
+ content = re.sub(re.compile(whitespace_pattern, re.MULTILINE), '', unicode(content))
return content.strip()