From 20bf8f7799ac89654fefca5b3c657601e8dd4bcd Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Sun, 22 Aug 2004 12:45:47 +0000 Subject: [PATCH] (XmlWriter.write_family_handle): Use GRAMPS ID not DB handle. (XmlWriter.write_xml_data): Sort family IDs before writing. svn: r3472 --- gramps2/ChangeLog | 4 +++- gramps2/src/WriteXML.py | 17 +++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 7707cc694..b90cb45af 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,9 +1,11 @@ 2004-08-22 Tim Waugh * src/WriteXML.py (write_xml_data): Fixed typo causing XML export to omit all place definitions. - (XmlWriter.write_xml_data): Sort person handles before writing. + (XmlWriter.write_xml_data): Sort person IDs before writing. (XmlWriter.write_xml_data): Fixed people output by preventing confusion between handles and GRAMPS IDs. + (XmlWriter.write_family_handle): Use GRAMPS ID not DB handle. + (XmlWriter.write_xml_data): Sort family IDs before writing. * src/RelLib.py (probably_alive): Fixed typo (bug #1012347). diff --git a/gramps2/src/WriteXML.py b/gramps2/src/WriteXML.py index b86e01ffa..07732f7b9 100644 --- a/gramps2/src/WriteXML.py +++ b/gramps2/src/WriteXML.py @@ -198,9 +198,8 @@ class XmlWriter: date = string.split(time.ctime(time.time())) owner = self.db.get_researcher() - familyList = self.db.get_family_handles() person_len = self.db.get_number_of_people() - family_len = len(familyList) + family_len = len(self.db.get_family_handles()) source_len = len(self.db.get_source_handles()) place_len = len(self.db.get_place_handles()) objList = self.db.get_media_object_handles() @@ -325,9 +324,15 @@ class XmlWriter: if family_len > 0: self.g.write(" \n") - familyList.sort () - for key in self.db.get_family_handles(): - family = self.db.get_family_from_handle(key) + keys = self.db.get_family_handles() + sorted_keys = [] + for key in keys: + family = self.db.get_family_from_handle(key) + tuple = (family.get_gramps_id (), family) + sorted_keys.append (tuple) + + sorted_keys.sort () + for (gramps_id, family) in sorted_keys: if self.callback and count % delta == 0: self.callback(float(count)/float(total)) count = count + 1 @@ -548,7 +553,7 @@ class XmlWriter: rel = family.get_relationship() comp = family.get_complete_flag() sp = " " * index - self.g.write('%s