diff --git a/ChangeLog b/ChangeLog index b1d645b6f..4374d3fbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-12 Brian Matherly + * src/plugins/NarrativeWeb.py: + * src/Sort.py: (use locale.strcoll for sorting) + 0001238: Web report: sort references for places and media + 2007-10-12 Don Allingham * src/gen/lib/note.py (Note.get): fix typo diff --git a/src/Sort.py b/src/Sort.py index 7d9ea35c1..d58e48654 100644 --- a/src/Sort.py +++ b/src/Sort.py @@ -128,4 +128,13 @@ class Sort: return 0 a_obj = self.database.get_place_from_handle(a_id) b_obj = self.database.get_place_from_handle(b_id) - return cmp(a_obj.title, b_obj.title) + return locale.strcoll(a_obj.title, b_obj.title) + + def by_media_title(self,a_id,b_id): + """Sort routine for comparing two media objects by their title. """ + if not (a_id and b_id): + return False + a = self.database.get_object_from_handle(a_id) + b = self.database.get_object_from_handle(b_id) + return locale.strcoll(a.desc,b.desc) + diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index 8acab0a30..976142837 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -1529,7 +1529,8 @@ class GalleryPage(BasePage): index = 1 mlist = media_list.keys() - mlist.sort(self.by_media_title) + sort = Sort.Sort(self.db) + mlist.sort(sort.by_media_title) for handle in mlist: media = db.get_object_from_handle(handle) date = _dd.display(media.get_date_object()) @@ -1554,15 +1555,6 @@ class GalleryPage(BasePage): self.display_footer(of,db) self.close_file(of) - def by_media_title(self,a_id,b_id): - """Sort routine for comparing two events by their dates. """ - if not (a_id and b_id): - return False - a = self.db.get_object_from_handle(a_id) - b = self.db.get_object_from_handle(b_id) - return cmp(a.desc,b.desc) - - #------------------------------------------------------------------------ # # @@ -2589,7 +2581,8 @@ class WebReport(Report): total = len(self.photo_list) index = 1 photo_keys = self.photo_list.keys() - photo_keys.sort(self.by_media_title) + sort = Sort.Sort(self.database) + photo_keys.sort(sort.by_media_title) for photo_handle in photo_keys: gc.collect() # Reduce memory usage when there are many images. @@ -2604,14 +2597,6 @@ class WebReport(Report): prev = photo_handle index += 1 - def by_media_title(self,a_id,b_id): - """Sort routine for comparing two events by their dates. """ - if not (a_id and b_id): - return False - a = self.database.get_object_from_handle(a_id) - b = self.database.get_object_from_handle(b_id) - return cmp(a.desc,b.desc) - def base_pages(self, photo_list, archive): if self.use_home: