5990: order of families not preserved across XML export-import

svn: r20244
This commit is contained in:
Doug Blank 2012-08-21 18:33:37 +00:00
parent 4943108b46
commit 72e22023a0

View File

@ -248,7 +248,7 @@ class GrampsXmlWriter(UpdateCallback):
# Write table objects # Write table objects
if tag_len > 0: if tag_len > 0:
self.g.write(" <tags>\n") self.g.write(" <tags>\n")
for key in self.db.get_tag_handles(): for key in sorted(self.db.get_tag_handles()):
tag = self.db.get_tag_from_handle(key) tag = self.db.get_tag_from_handle(key)
self.write_tag(tag, 2) self.write_tag(tag, 2)
self.update() self.update()
@ -257,7 +257,7 @@ class GrampsXmlWriter(UpdateCallback):
# Write primary objects # Write primary objects
if event_len > 0: if event_len > 0:
self.g.write(" <events>\n") self.g.write(" <events>\n")
for handle in self.db.get_event_handles(): for handle in sorted(self.db.get_event_handles()):
event = self.db.get_event_from_handle(handle) event = self.db.get_event_from_handle(handle)
self.write_event(event,2) self.write_event(event,2)
self.update() self.update()
@ -270,7 +270,7 @@ class GrampsXmlWriter(UpdateCallback):
self.g.write(' home="_%s"' % person.handle) self.g.write(' home="_%s"' % person.handle)
self.g.write('>\n') self.g.write('>\n')
for handle in self.db.get_person_handles(): for handle in sorted(self.db.get_person_handles()):
person = self.db.get_person_from_handle(handle) person = self.db.get_person_from_handle(handle)
self.write_person(person, 2) self.write_person(person, 2)
self.update() self.update()
@ -278,7 +278,7 @@ class GrampsXmlWriter(UpdateCallback):
if family_len > 0: if family_len > 0:
self.g.write(" <families>\n") self.g.write(" <families>\n")
for handle in self.db.iter_family_handles(): for handle in sorted(self.db.iter_family_handles()):
family = self.db.get_family_from_handle(handle) family = self.db.get_family_from_handle(handle)
self.write_family(family,2) self.write_family(family,2)
self.update() self.update()
@ -286,7 +286,7 @@ class GrampsXmlWriter(UpdateCallback):
if citation_len > 0: if citation_len > 0:
self.g.write(" <citations>\n") self.g.write(" <citations>\n")
for handle in self.db.get_citation_handles(): for handle in sorted(self.db.get_citation_handles()):
citation = self.db.get_citation_from_handle(handle) citation = self.db.get_citation_from_handle(handle)
self.write_citation(citation,2) self.write_citation(citation,2)
self.update() self.update()
@ -294,7 +294,7 @@ class GrampsXmlWriter(UpdateCallback):
if source_len > 0: if source_len > 0:
self.g.write(" <sources>\n") self.g.write(" <sources>\n")
for handle in self.db.get_source_handles(): for handle in sorted(self.db.get_source_handles()):
source = self.db.get_source_from_handle(handle) source = self.db.get_source_from_handle(handle)
self.write_source(source,2) self.write_source(source,2)
self.update() self.update()
@ -302,7 +302,7 @@ class GrampsXmlWriter(UpdateCallback):
if place_len > 0: if place_len > 0:
self.g.write(" <places>\n") self.g.write(" <places>\n")
for key in self.db.get_place_handles(): for key in sorted(self.db.get_place_handles()):
# try: # try:
place = self.db.get_place_from_handle(key) place = self.db.get_place_from_handle(key)
self.write_place_obj(place,2) self.write_place_obj(place,2)
@ -311,7 +311,7 @@ class GrampsXmlWriter(UpdateCallback):
if obj_len > 0: if obj_len > 0:
self.g.write(" <objects>\n") self.g.write(" <objects>\n")
for handle in self.db.get_media_object_handles(): for handle in sorted(self.db.get_media_object_handles()):
obj = self.db.get_object_from_handle(handle) obj = self.db.get_object_from_handle(handle)
self.write_object(obj,2) self.write_object(obj,2)
self.update() self.update()
@ -319,7 +319,7 @@ class GrampsXmlWriter(UpdateCallback):
if repo_len > 0: if repo_len > 0:
self.g.write(" <repositories>\n") self.g.write(" <repositories>\n")
for key in self.db.get_repository_handles(): for key in sorted(self.db.get_repository_handles()):
repo = self.db.get_repository_from_handle(key) repo = self.db.get_repository_from_handle(key)
self.write_repository(repo,2) self.write_repository(repo,2)
self.update() self.update()
@ -327,7 +327,7 @@ class GrampsXmlWriter(UpdateCallback):
if note_len > 0: if note_len > 0:
self.g.write(" <notes>\n") self.g.write(" <notes>\n")
for key in self.db.get_note_handles(): for key in sorted(self.db.get_note_handles()):
note = self.db.get_note_from_handle(key) note = self.db.get_note_from_handle(key)
self.write_note(note, 2) self.write_note(note, 2)
self.update() self.update()
@ -526,10 +526,10 @@ class GrampsXmlWriter(UpdateCallback):
self.write_attribute_list(person.get_attribute_list()) self.write_attribute_list(person.get_attribute_list())
self.write_url_list(person.get_url_list(),index+1) self.write_url_list(person.get_url_list(),index+1)
for family_handle in sorted(person.get_parent_family_handle_list()): for family_handle in person.get_parent_family_handle_list():
self.write_ref("childof",family_handle,index+1) self.write_ref("childof",family_handle,index+1)
for family_handle in sorted(person.get_family_handle_list()): for family_handle in person.get_family_handle_list():
self.write_ref("parentin",family_handle,index+1) self.write_ref("parentin",family_handle,index+1)
for person_ref in person.get_person_ref_list(): for person_ref in person.get_person_ref_list():