replace unicode call with force_text

This commit is contained in:
Paul Oswald 2014-08-19 10:09:48 +09:00
parent 192201d584
commit 3e93c96ece

View File

@ -5,6 +5,8 @@ from __future__ import unicode_literals
from django.utils.html import escape from django.utils.html import escape
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.encoding import force_text
from rest_framework.compat import apply_markdown from rest_framework.compat import apply_markdown
import re import re
@ -28,7 +30,7 @@ def dedent(content):
as it fails to dedent multiline docstrings that include as it fails to dedent multiline docstrings that include
unindented text on the initial line. unindented text on the initial line.
""" """
content = unicode(content) content = force_text(content)
whitespace_counts = [len(line) - len(line.lstrip(' ')) whitespace_counts = [len(line) - len(line.lstrip(' '))
for line in content.splitlines()[1:] if line.lstrip()] for line in content.splitlines()[1:] if line.lstrip()]