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

View File

@ -162,8 +162,8 @@ class XmlWriter:
owner = self.db.getResearcher()
familyMap = self.db.getFamilyMap()
familyList = familyMap.keys ()
person_len = len(self.db.getPersonKeys())
family_len = len(familyList)
person_len = self.db.getPersonLength()
family_len = len(familyMap)
source_len = len(self.db.getSourceKeys())
place_len = len(self.db.getPlaceKeys())
objMap = self.db.getObjectMap()
@ -203,10 +203,13 @@ class XmlWriter:
self.g.write(' default="%s"' % person.getId())
self.g.write(">\n")
keys = self.db.getPersonKeys()
keys.sort ()
for key in keys:
for key in self.db.sortPersonKeys():
try:
person = self.db.getPerson(key)
except:
print "Key error %s" % key
continue
if self.callback and count % delta == 0:
self.callback(float(count)/float(total))
count = count + 1

View File

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