There are three bugs which give mistery sort problems :

1 : The normalize function use NFC in one place and NFKC in all others.
    either we use NFC or we use NFKC, but don't mix these two modes.
2 : One sort function does not use the locale.strcoll
3 : There is a problem with the following statement:
    if letter is not last_letter. "is not" doesn't work correctly.



svn: r12482
This commit is contained in:
Serge Noiraud 2009-04-20 20:44:22 +00:00
parent 0cc4adaad6
commit 21414d184f

View File

@ -1536,7 +1536,7 @@ class SurnameListPage(BasePage):
index_val = "%90d_%s" % (999999999-len(data_list), surname)
temp_list[index_val] = (surname, data_list)
temp_keys = temp_list.keys()
temp_keys.sort()
temp_keys.sort(locale.strcoll)
person_handle_list = []
for key in temp_keys:
person_handle_list.append(temp_list[key])
@ -1552,7 +1552,7 @@ class SurnameListPage(BasePage):
# the surname
letter = normalize('NFKC', surname)[0].upper()
if letter is not last_letter:
if letter != last_letter:
last_letter = letter
of.write('\t\t<tr class="BeginLetter">\n')
of.write('\t\t\t<td class="ColumnLetter"><a name="%s">%s</a></td>\n'
@ -3632,7 +3632,7 @@ def get_first_letters(db, handle_list, key):
keyname = get_place_keyname(db, handle)
if keyname:
c = normalize('NFC', keyname)[0].upper()
c = normalize('NFKC', keyname)[0].upper()
first_letters.append(c)
return first_letters