From 8b097dc4e0777cf9a2f0943eeda4c6db23fbace5 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 2 Oct 2020 13:54:16 +0200 Subject: [PATCH] Normalize after replacing L' --- media/forms.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/media/forms.py b/media/forms.py index cb509f4..1704817 100644 --- a/media/forms.py +++ b/media/forms.py @@ -21,13 +21,6 @@ def generate_side_identifier(title, authors, subtitle=None): title_normalized = title.upper() title_normalized = title_normalized.replace('’', '\'') - title_normalized = ''.join( - char - for char in unicodedata.normalize( - 'NFKD', title_normalized.casefold()) - if all(not unicodedata.category(char).startswith(cat) - for cat in {'M', 'P', 'Z', 'C'}) or char == ' ' - ).casefold().upper() title_normalized = re.sub(r'^DE ', '', title_normalized) title_normalized = re.sub(r'^LE ', '', title_normalized) title_normalized = re.sub(r'^LA ', '', title_normalized) @@ -37,6 +30,13 @@ def generate_side_identifier(title, authors, subtitle=None): title_normalized = re.sub(r'Œ', 'OE', title_normalized) title_normalized = title_normalized.replace(' ', '') title_normalized = re.sub("[^A-Z0-9$]", "", title_normalized) + title_normalized = ''.join( + char + for char in unicodedata.normalize( + 'NFKD', title_normalized.casefold()) + if all(not unicodedata.category(char).startswith(cat) + for cat in {'M', 'P', 'Z', 'C'}) or char == ' ' + ).casefold().upper() authors = authors.copy() def sort(author):