Skip to content

Commit a71395b

Browse files
committed
remove Unidecode dependency
1 parent 0c764e2 commit a71395b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sendfile/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ def sendfile(request, filename, attachment=False, attachment_filename=None, mime
7070
attachment_filename = os.path.basename(filename)
7171
parts = ['attachment']
7272
if attachment_filename:
73-
from unidecode import unidecode
73+
import unicodedata
7474
try:
7575
from django.utils.encoding import force_text
7676
except ImportError:
7777
# Django 1.3
7878
from django.utils.encoding import force_unicode as force_text
7979
attachment_filename = force_text(attachment_filename)
80-
ascii_filename = unidecode(attachment_filename)
80+
ascii_filename = unicodedata.normalize('NFKD', attachment_filename).encode('ascii','ignore')
8181
parts.append('filename="%s"' % ascii_filename)
8282
if ascii_filename != attachment_filename:
8383
from django.utils.http import urlquote

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
url='https://github.com/johnsensible/django-sendfile',
2020
license='BSD',
2121

22-
requires=['Django (>=1.3)', 'Unidecode'],
23-
install_requires=['Django>=1.3', 'Unidecode'],
22+
requires=['Django (>=1.3)'],
23+
install_requires=['Django>=1.3'],
2424

2525
packages=['sendfile', 'sendfile.backends'],
2626
package_dir={

0 commit comments

Comments
 (0)