Skip to content
Myr

Remove unidecode dependency and use unicodedata instead

Before adoption: this commit came in with the history the project adopted, so no landing records it.

I found a way to remove the unidecode dependency without sacrificing much by using unicodedata.normalize .

authored by Antonio Larrosa · committed by Antonio Larrosa · parent 6ef45f3 · Browse files · 3 files+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+4 added−4 removed

  • other:+4 added−4 removed

3 files+4 added−4 removed

modified:flask/helpers.py+4 added-2 removed
12 unmodified lines
13import sys14import pkgutil15import posixpath16import mimetypes17import unicodedata18from time import time19from zlib import adler3220from threading import RLock21from werkzeug.routing import BuildError
19 unmodified lines
41from .signals import message_flashed42from .globals import session, _request_ctx_stack, _app_ctx_stack, \43 current_app, request44from ._compat import string_types, text_type44from unidecode import unidecode454647# sentinel48_missing = object()
486 unmodified lines
535 if attachment_filename is None:536 raise TypeError('filename unavailable, required for '537 'sending as attachment')538 filename_dict = {539 'filename': unidecode(text_type(attachment_filename)),539 'filename': (unicodedata.normalize('NFKD',540 text_type(attachment_filename)).encode('ascii',541 'ignore')),542 'filename*': "UTF-8''%s" % url_quote(attachment_filename)}543 headers.add('Content-Disposition', 'attachment',544 **filename_dict)545
421 unmodified lines
modified:setup.py-1 removed
73 unmodified lines
74 'Werkzeug>=0.7',75 'Jinja2>=2.4',76 'itsdangerous>=0.21',77 'click>=2.0',78 'unidecode',78 ],79 classifiers=[80 'Development Status :: 4 - Beta',81 'Environment :: Web Environment',
19 unmodified lines
modified:tox.ini-1 removed
25 unmodified lines
26 devel: git+https://github.com/pallets/jinja.git27 devel: git+https://github.com/pallets/itsdangerous.git28 devel: git+https://github.com/jek/blinker.git29 simplejson: simplejson30 unidecode3031[testenv:docs]32deps = sphinx33commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck