From 3e93c96ece8af010185e1fe1188dd2df569d4528 Mon Sep 17 00:00:00 2001 From: Paul Oswald Date: Tue, 19 Aug 2014 10:09:48 +0900 Subject: [PATCH] replace unicode call with force_text --- rest_framework/utils/formatting.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rest_framework/utils/formatting.py b/rest_framework/utils/formatting.py index 2b3cbc957..40bced5f1 100644 --- a/rest_framework/utils/formatting.py +++ b/rest_framework/utils/formatting.py @@ -5,6 +5,8 @@ from __future__ import unicode_literals from django.utils.html import escape from django.utils.safestring import mark_safe +from django.utils.encoding import force_text + from rest_framework.compat import apply_markdown import re @@ -28,7 +30,7 @@ def dedent(content): as it fails to dedent multiline docstrings that include unindented text on the initial line. """ - content = unicode(content) + content = force_text(content) whitespace_counts = [len(line) - len(line.lstrip(' ')) for line in content.splitlines()[1:] if line.lstrip()]