Mercurial > p > roundup > code
diff roundup/backends/indexer_dbm.py @ 5470:e2baa4e6ed6d
handle words starting with unicode characters
| author | Christof Meerwald <cmeerw@cmeerw.org> |
|---|---|
| date | Sat, 28 Jul 2018 22:39:24 +0100 |
| parents | 23b8e6067f7c |
| children | 4c7662c86a36 |
line wrap: on
line diff
--- a/roundup/backends/indexer_dbm.py Sat Jul 28 22:28:13 2018 +0100 +++ b/roundup/backends/indexer_dbm.py Sat Jul 28 22:39:24 2018 +0100 @@ -189,7 +189,10 @@ else: segments = ['-','#'] for word in wordlist: - segments.append(word[0].upper()) + initchar = word[0].upper() + if initchar not in self.segments: + initchar = '_' + segments.append(initchar) # Load the segments for segment in segments: @@ -242,6 +245,9 @@ segdicts[segment] = {} for word, entry in self.words.items(): # Split into segment dicts initchar = word[0].upper() + if initchar not in letters: + # if it's a unicode character, add it to the '_' segment + initchar = '_' segdicts[initchar][word] = entry # save
