forked from orbit-oss/flask
Remove unidecode dependency and use unicodedata instead
I found a way to remove the unidecode dependency without sacrificing much by using unicodedata.normalize .
This commit is contained in:
parent
6ef45f30ab
commit
bf023e7dc0
3 changed files with 4 additions and 4 deletions
|
|
@ -14,6 +14,7 @@ import sys
|
|||
import pkgutil
|
||||
import posixpath
|
||||
import mimetypes
|
||||
import unicodedata
|
||||
from time import time
|
||||
from zlib import adler32
|
||||
from threading import RLock
|
||||
|
|
@ -41,7 +42,6 @@ from .signals import message_flashed
|
|||
from .globals import session, _request_ctx_stack, _app_ctx_stack, \
|
||||
current_app, request
|
||||
from ._compat import string_types, text_type
|
||||
from unidecode import unidecode
|
||||
|
||||
|
||||
# sentinel
|
||||
|
|
@ -536,7 +536,9 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
|
|||
raise TypeError('filename unavailable, required for '
|
||||
'sending as attachment')
|
||||
filename_dict = {
|
||||
'filename': unidecode(text_type(attachment_filename)),
|
||||
'filename': (unicodedata.normalize('NFKD',
|
||||
text_type(attachment_filename)).encode('ascii',
|
||||
'ignore')),
|
||||
'filename*': "UTF-8''%s" % url_quote(attachment_filename)}
|
||||
headers.add('Content-Disposition', 'attachment',
|
||||
**filename_dict)
|
||||
|
|
|
|||
1
setup.py
1
setup.py
|
|
@ -75,7 +75,6 @@ setup(
|
|||
'Jinja2>=2.4',
|
||||
'itsdangerous>=0.21',
|
||||
'click>=2.0',
|
||||
'unidecode',
|
||||
],
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
|
|
|
|||
1
tox.ini
1
tox.ini
|
|
@ -27,7 +27,6 @@ deps=
|
|||
devel: git+https://github.com/pallets/itsdangerous.git
|
||||
devel: git+https://github.com/jek/blinker.git
|
||||
simplejson: simplejson
|
||||
unidecode
|
||||
|
||||
[testenv:docs]
|
||||
deps = sphinx
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue