2003-06-19 Tim Waugh <twaugh@redhat.com>

* src/WriteXML.py (write_xml_data): Use a stable order for writing
        elements in XML.  This makes it useful to do revision control (RFE
        748165).


svn: r1763
This commit is contained in:
Tim Waugh 2003-06-19 09:49:43 +00:00
parent cc8dd8268e
commit f1a8c83e55
2 changed files with 25 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2003-06-19 Tim Waugh <twaugh@redhat.com>
* src/WriteXML.py (write_xml_data): Use a stable order for writing
elements in XML. This makes it useful to do revision control (RFE
748165).
2003-06-18 Don Allingham <dallingham@users.sourceforge.net> 2003-06-18 Don Allingham <dallingham@users.sourceforge.net>
* src/FamilyView.py: keep focus on correct family after a new * src/FamilyView.py: keep focus on correct family after a new
child is added child is added

View File

@ -160,12 +160,14 @@ class XmlWriter:
date = string.split(time.ctime(time.time())) date = string.split(time.ctime(time.time()))
owner = self.db.getResearcher() owner = self.db.getResearcher()
familyList = self.db.getFamilyMap().values() familyMap = self.db.getFamilyMap()
familyList = familyMap.keys ()
person_len = len(self.db.getPersonKeys()) person_len = len(self.db.getPersonKeys())
family_len = len(familyList) family_len = len(familyList)
source_len = len(self.db.getSourceKeys()) source_len = len(self.db.getSourceKeys())
place_len = len(self.db.getPlaceKeys()) place_len = len(self.db.getPlaceKeys())
objList = self.db.getObjectMap().values() objMap = self.db.getObjectMap()
objList = objMap.keys ()
total = person_len + family_len + place_len + source_len total = person_len + family_len + place_len + source_len
@ -201,7 +203,9 @@ class XmlWriter:
self.g.write(' default="%s"' % person.getId()) self.g.write(' default="%s"' % person.getId())
self.g.write(">\n") self.g.write(">\n")
for key in self.db.getPersonKeys(): keys = self.db.getPersonKeys()
keys.sort ()
for key in keys:
person = self.db.getPerson(key) person = self.db.getPerson(key)
if self.callback and count % delta == 0: if self.callback and count % delta == 0:
self.callback(float(count)/float(total)) self.callback(float(count)/float(total))
@ -275,7 +279,9 @@ class XmlWriter:
if family_len > 0: if family_len > 0:
self.g.write(" <families>\n") self.g.write(" <families>\n")
for family in familyList: familyList.sort ()
for key in familyList:
family = familyMap[key]
if self.callback and count % delta == 0: if self.callback and count % delta == 0:
self.callback(float(count)/float(total)) self.callback(float(count)/float(total))
count = count + 1 count = count + 1
@ -303,7 +309,9 @@ class XmlWriter:
if source_len > 0: if source_len > 0:
self.g.write(" <sources>\n") self.g.write(" <sources>\n")
for key in self.db.getSourceKeys(): keys = self.db.getSourceKeys ()
keys.sort ()
for key in keys:
source = self.db.getSource(key) source = self.db.getSource(key)
if self.callback and count % delta == 0: if self.callback and count % delta == 0:
self.callback(float(count)/float(total)) self.callback(float(count)/float(total))
@ -321,7 +329,9 @@ class XmlWriter:
if place_len > 0: if place_len > 0:
self.g.write(" <places>\n") self.g.write(" <places>\n")
for key in self.db.getPlaceKeys(): keys = self.db.getPlaceKeys()
keys.sort ()
for key in keys:
try: try:
place = self.db.getPlace(key) place = self.db.getPlace(key)
if self.callback and count % delta == 0: if self.callback and count % delta == 0:
@ -335,7 +345,9 @@ class XmlWriter:
if len(objList) > 0: if len(objList) > 0:
self.g.write(" <objects>\n") self.g.write(" <objects>\n")
for object in objList: objList.sort ()
for key in objList:
object = objMap[key]
self.write_object(object) self.write_object(object)
self.g.write(" </objects>\n") self.g.write(" </objects>\n")