diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 5d27098a3..593e8bd0e 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2005-08-04 Don Allingham + * 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 * src/NavWebPage.py: use new ProgressMeter, add ability to not generate a CSS style sheet. diff --git a/gramps2/src/PeopleModel.py b/gramps2/src/PeopleModel.py index cd3f45289..5f3910447 100644 --- a/gramps2/src/PeopleModel.py +++ b/gramps2/src/PeopleModel.py @@ -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) diff --git a/gramps2/src/ReadGedcom.py b/gramps2/src/ReadGedcom.py index 28ae82ff5..4e4b823ce 100644 --- a/gramps2/src/ReadGedcom.py +++ b/gramps2/src/ReadGedcom.py @@ -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]: