* src/PeopleModel.py: provide a work around for the python 2.3 bug unicode
sorting problem with locale.strcoll. For a nul termination during sorting, strip it off after sorting. Only used for python2.3, since this bug was fixed in python 2.4. svn: r5012
This commit is contained in:
parent
ad2ef89450
commit
335580cc90
@ -1,3 +1,9 @@
|
||||
2005-08-04 Don Allingham <don@gramps-project.org>
|
||||
* src/PeopleModel.py: provide a work around for the python 2.3 bug unicode
|
||||
sorting problem with locale.strcoll. For a nul termination during sorting,
|
||||
strip it off after sorting. Only used for python2.3, since this bug was
|
||||
fixed in python 2.4.
|
||||
|
||||
2005-08-03 Don Allingham <don@gramps-project.org>
|
||||
* src/NavWebPage.py: use new ProgressMeter, add ability to
|
||||
not generate a CSS style sheet.
|
||||
|
@ -30,6 +30,7 @@ import time
|
||||
import locale
|
||||
import cgi
|
||||
import sets
|
||||
import sys
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -71,6 +72,25 @@ _EVENT_COL = 8
|
||||
_FAMILY_COL= 9
|
||||
_CHANGE_COL= 21
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# python 2.3 has a bug in the unicode sorting using locale.strcoll. Seems
|
||||
# to have a buffer overrun. We can convince it to do the right thing by
|
||||
# forcing the string to be nul terminated, sorting, then stripping off the
|
||||
# nul.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
if sys.version_info[0:2] == (2,3):
|
||||
def locale_sort(mylist):
|
||||
mylist = map(lambda x: x + "\x00", mylist)
|
||||
mylist.sort(locale.strcoll)
|
||||
return map(lambda x: x[:-1], mylist)
|
||||
else:
|
||||
def locale_sort(mylist):
|
||||
mylist.sort(locale.strcoll)
|
||||
return mylist
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PeopleModel
|
||||
@ -136,8 +156,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
node = cursor.next()
|
||||
cursor.close()
|
||||
|
||||
self.temp_top_path2iter = self.temp_sname_sub.keys()
|
||||
self.temp_top_path2iter.sort(locale.strcoll)
|
||||
self.temp_top_path2iter = locale_sort(self.temp_sname_sub.keys())
|
||||
for name in self.temp_top_path2iter:
|
||||
self.build_sub_entry(name)
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ class GedcomParser:
|
||||
event.set_name("Death")
|
||||
self.person.set_death_handle(event.get_handle())
|
||||
self.parse_person_event(event,2)
|
||||
self.db.commit_peronal_event(event, self.trans)
|
||||
self.db.commit_personal_event(event, self.trans)
|
||||
elif matches[1] == "EVEN":
|
||||
event = RelLib.Event()
|
||||
if matches[2]:
|
||||
|
Loading…
Reference in New Issue
Block a user