summaryrefslogtreecommitdiff
path: root/cherrypy
diff options
context:
space:
mode:
authorJan Rieger <jrx@centrum.cz>2020-04-17 11:13:38 +0200
committerSviatoslav Sydorenko <wk@sydorenko.org.ua>2020-04-17 17:56:24 +0200
commitb30943602ac4b89feca369347f29f69a9cc127ef (patch)
tree9766da13b9a498dae26bfdf5ee657510b4e0c516 /cherrypy
parenta906ced81451c15a958181386a8492b25bb2ee1c (diff)
downloadcherrypy-git-b30943602ac4b89feca369347f29f69a9cc127ef.tar.gz
Move normalization algorithm description from docstring to code comments.
Diffstat (limited to 'cherrypy')
-rw-r--r--cherrypy/lib/static.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/cherrypy/lib/static.py b/cherrypy/lib/static.py
index 70556739..6c764c2a 100644
--- a/cherrypy/lib/static.py
+++ b/cherrypy/lib/static.py
@@ -34,15 +34,14 @@ def _make_content_disposition(disposition, file_name):
This function implements the recommendations of :rfc:`6266#appendix-D`.
See this and related answers: https://stackoverflow.com/a/8996249/2173868.
-
- As normalization algorithm for `unicodedata` is used composed form (NFC and NKFC)
- with compatibility equivalence criteria (NFK), so "NKFC" is the one.
- It first applies the compatibility decomposition, followed by the canonical
- composition. Should be displayed in the same manner, should be treated in
- the same way by applications such as alphabetizing names or searching,
- and may be substituted for each other.
- See: https://en.wikipedia.org/wiki/Unicode_equivalence.
"""
+ # As normalization algorithm for `unicodedata` is used composed form (NFC and NKFC)
+ # with compatibility equivalence criteria (NFK), so "NKFC" is the one.
+ # It first applies the compatibility decomposition, followed by the canonical
+ # composition. Should be displayed in the same manner, should be treated in
+ # the same way by applications such as alphabetizing names or searching,
+ # and may be substituted for each other.
+ # See: https://en.wikipedia.org/wiki/Unicode_equivalence.
ascii_name = (
unicodedata.normalize('NKFC', file_name).
encode('ascii', errors='ignore').decode()