* src/plugins/WriteFtree.py: catch file open exception

* src/WriteXML.py: try to handle invalid IDs
* src/RelLib.py: minor organizational cleanup


svn: r2322
This commit is contained in:
Don Allingham 2003-11-10 22:31:07 +00:00
parent 874bee1f7c
commit fa5205c3de
3 changed files with 20 additions and 15 deletions

View File

@ -2069,17 +2069,17 @@ class GrampsDB:
"""creates a new GrampsDB""" """creates a new GrampsDB"""
self.surnames = [] self.surnames = []
self.personTable = {} self.personTable = {}
self.personMap = {}
self.placeTable = {} self.placeTable = {}
self.placeMap = {}
self.sourceTable = {} self.sourceTable = {}
self.sourceMap = {}
self.familyMap = {}
self.iprefix = "I%d" self.iprefix = "I%d"
self.sprefix = "S%d" self.sprefix = "S%d"
self.oprefix = "O%d" self.oprefix = "O%d"
self.pprefix = "P%d" self.pprefix = "P%d"
self.fprefix = "F%d" self.fprefix = "F%d"
self.familyMap = {}
self.personMap = {}
self.sourceMap = {}
self.placeMap = {}
self.new() self.new()
self.added_files = [] self.added_files = []
self.genderStats = GenderStats () self.genderStats = GenderStats ()
@ -2193,12 +2193,12 @@ class GrampsDB:
self.surnames = [] self.surnames = []
self.personMap = {} self.personMap = {}
self.sourceMap = {}
self.placeMap = {}
self.objectMap = {}
self.personTable = {} self.personTable = {}
self.placeTable = {} self.sourceMap = {}
self.sourceTable = {} self.sourceTable = {}
self.placeMap = {}
self.placeTable = {}
self.objectMap = {}
self.smapIndex = 0 self.smapIndex = 0
self.pmapIndex = 0 self.pmapIndex = 0
self.fmapIndex = 0 self.fmapIndex = 0

View File

@ -162,8 +162,8 @@ class XmlWriter:
owner = self.db.getResearcher() owner = self.db.getResearcher()
familyMap = self.db.getFamilyMap() familyMap = self.db.getFamilyMap()
familyList = familyMap.keys () familyList = familyMap.keys ()
person_len = len(self.db.getPersonKeys()) person_len = self.db.getPersonLength()
family_len = len(familyList) family_len = len(familyMap)
source_len = len(self.db.getSourceKeys()) source_len = len(self.db.getSourceKeys())
place_len = len(self.db.getPlaceKeys()) place_len = len(self.db.getPlaceKeys())
objMap = self.db.getObjectMap() objMap = self.db.getObjectMap()
@ -203,10 +203,13 @@ class XmlWriter:
self.g.write(' default="%s"' % person.getId()) self.g.write(' default="%s"' % person.getId())
self.g.write(">\n") self.g.write(">\n")
keys = self.db.getPersonKeys() for key in self.db.sortPersonKeys():
keys.sort () try:
for key in keys: person = self.db.getPerson(key)
person = self.db.getPerson(key) except:
print "Key error %s" % key
continue
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

View File

@ -48,7 +48,7 @@ import Utils
import GenericFilter import GenericFilter
import Errors import Errors
from QuestionDialog import MissingMediaDialog from QuestionDialog import MissingMediaDialog, ErrorDialog
from gettext import gettext as _ from gettext import gettext as _
@ -135,6 +135,8 @@ class FtreeWriter:
Utils.destroy_passed_object(self.topwin) Utils.destroy_passed_object(self.topwin)
try: try:
self.export(name, pfilter, restrict) self.export(name, pfilter, restrict)
except (IOError,OSError),msg:
ErrorDialog(_("Could not create %s") % name, msg)
except: except:
import DisplayTrace import DisplayTrace
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()