Browse Source

Corrige un bug lors de la génération des index

Les characters spéciaux (?, $, €, ...) faisaient planter la compilation
pull/58/head
Luthaf 11 years ago
parent
commit
823c633943
  1. 6
      patacrep/index.py

6
patacrep/index.py

@ -73,7 +73,11 @@ class Index(object):
@staticmethod @staticmethod
def get_first_letter(key): def get_first_letter(key):
"""Return the uppercase first letter of 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): if re.match(ur'\d', letter):
letter = '0-9' letter = '0-9'
return letter.upper() return letter.upper()

Loading…
Cancel
Save