fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Experimental preview of 2022 book detail page.
[wolnelektury.git]
/
src
/
sortify.py
diff --git
a/src/sortify.py
b/src/sortify.py
index
941f50f
..
0278601
100644
(file)
--- a/
src/sortify.py
+++ b/
src/sortify.py
@@
-1,4
+1,6
@@
-# -*- coding: utf-8 -*-
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
import re
from fnpdjango.utils.text import char_map
import re
from fnpdjango.utils.text import char_map
@@
-6,7
+8,7
@@
from fnpdjango.utils.text import char_map
# Specifies diacritics order.
# Default order is zero, max is 9
char_order = {
# Specifies diacritics order.
# Default order is zero, max is 9
char_order = {
-
u'ż': 1, u
'Ż': 1,
+
'ż': 1,
'Ż': 1,
}
}
@@
-41,4
+43,4
@@
def sortify(value):
value = value.lower()
value = re.sub(r'[^a-z0-9~]+', ' ', value)
value = value.lower()
value = re.sub(r'[^a-z0-9~]+', ' ', value)
- return value.encode('ascii', 'ignore')
+ return value.encode('ascii', 'ignore')
.decode('ascii')