From 823c633943c10519ce98b033a5635b8a90ec12cc Mon Sep 17 00:00:00 2001 From: Luthaf Date: Tue, 8 Jul 2014 13:45:59 +0100 Subject: [PATCH] =?UTF-8?q?Corrige=20un=20bug=20lors=20de=20la=20g=C3=A9n?= =?UTF-8?q?=C3=A9ration=20des=20index?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les characters spéciaux (?, $, €, ...) faisaient planter la compilation --- patacrep/index.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/patacrep/index.py b/patacrep/index.py index 5245c329..9c61835f 100755 --- a/patacrep/index.py +++ b/patacrep/index.py @@ -73,7 +73,11 @@ class Index(object): @staticmethod def get_first_letter(key): """Return the uppercase first letter of key.""" - letter = FIRST_LETTER_PATTERN.match(key).group(1) + try: + letter = FIRST_LETTER_PATTERN.match(key).group(1) + except AttributeError: + # classify as number all the non letter characters + letter = "0" if re.match(ur'\d', letter): letter = '0-9' return letter.upper()