Skip to content
This repository was archived by the owner on Oct 6, 2020. It is now read-only.

Commit 14f13b0

Browse files
author
Moritz Pfeiffer
committed
Changed encoding utils to smart_text, smart_bytes to support Django >= 1.4.2.
1 parent 7841251 commit 14f13b0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sendfile/backends/_internalredirect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os.path
22

33
from django.conf import settings
4-
from django.utils.encoding import force_text, force_bytes
4+
from django.utils.encoding import smart_text, smart_bytes
55

66
try:
77
from urllib.parse import quote
@@ -19,6 +19,6 @@ def _convert_file_to_url(filename):
1919
url.insert(1, head)
2020

2121
# Python3 urllib.parse.quote accepts both unicode and bytes, while Python2 urllib.quote only accepts bytes.
22-
# So force bytes for quoting and then go back to unicode.
23-
url = [force_bytes(url_component) for url_component in url]
24-
return force_text(quote(b'/'.join(url)))
22+
# So use bytes for quoting and then go back to unicode.
23+
url = [smart_bytes(url_component) for url_component in url]
24+
return smart_text(quote(b'/'.join(url)))

0 commit comments

Comments
 (0)