Skip to content

Commit d7e7f0a

Browse files
committed
Fixed failing test + moved import
1 parent a71395b commit d7e7f0a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sendfile/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os.path
55
from mimetypes import guess_type
6+
import unicodedata
67

78

89
def _lazy_load(fn):
@@ -70,7 +71,6 @@ def sendfile(request, filename, attachment=False, attachment_filename=None, mime
7071
attachment_filename = os.path.basename(filename)
7172
parts = ['attachment']
7273
if attachment_filename:
73-
import unicodedata
7474
try:
7575
from django.utils.encoding import force_text
7676
except ImportError:

sendfile/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_attachment_filename(self):
8585
def test_attachment_filename_unicode(self):
8686
response = real_sendfile(HttpRequest(), self._get_readme(), attachment=True, attachment_filename='test’s.txt')
8787
self.assertTrue(response is not None)
88-
self.assertEqual('attachment; filename="test\'s.txt"; filename*=UTF-8\'\'test%E2%80%99s.txt', response['Content-Disposition'])
88+
self.assertEqual('attachment; filename="tests.txt"; filename*=UTF-8\'\'test%E2%80%99s.txt', response['Content-Disposition'])
8989

9090

9191
class TestXSendfileBackend(TempFileTestCase):

0 commit comments

Comments
 (0)