2007-02-23 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_GedcomParse.py: handle error cases * src/GrampsDbUtils/_GedcomLex.py: handle error cases * src/GrampsDbUtils/_GedcomUtils.py: handle error cases svn: r8219
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2007-02-23 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/GrampsDbUtils/_GedcomParse.py: handle error cases
|
||||||
|
* src/GrampsDbUtils/_GedcomLex.py: handle error cases
|
||||||
|
* src/GrampsDbUtils/_GedcomUtils.py: handle error cases
|
||||||
|
|
||||||
2007-02-23 Alex Roitman <shura@phy.ucsf.edu>
|
2007-02-23 Alex Roitman <shura@phy.ucsf.edu>
|
||||||
* src/GrampsDb/_GrampsBSDDB.py (convert_notes_13): Skip empty notes.
|
* src/GrampsDb/_GrampsBSDDB.py (convert_notes_13): Skip empty notes.
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ def latin_to_utf8(s):
|
|||||||
return unicode(s,'iso-8859-1')
|
return unicode(s,'iso-8859-1')
|
||||||
|
|
||||||
def nocnv(s):
|
def nocnv(s):
|
||||||
return unicode(s)
|
return unicode(s,errors='replace')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -400,7 +400,7 @@ class Reader:
|
|||||||
except:
|
except:
|
||||||
line = self.cnv(line.translate(_transtable2))
|
line = self.cnv(line.translate(_transtable2))
|
||||||
else:
|
else:
|
||||||
line = unicode(line)
|
line = unicode(line,errors='replace')
|
||||||
|
|
||||||
line = line.split(None,2) + ['']
|
line = line.split(None,2) + ['']
|
||||||
|
|
||||||
|
@ -281,7 +281,15 @@ class StageOne:
|
|||||||
try:
|
try:
|
||||||
(level, key, value) = data[:3]
|
(level, key, value) = data[:3]
|
||||||
value = value.strip()
|
value = value.strip()
|
||||||
level = int(level)
|
# convert the first value to an integer. We have to be a bit
|
||||||
|
# careful here, since some GEDCOM files have garbage characters
|
||||||
|
# at the front of the first file if they are unicode encoded.
|
||||||
|
# So, if we have a failure to convert, check the last character
|
||||||
|
# of the string, which shoul de a '0'
|
||||||
|
try:
|
||||||
|
level = int(level)
|
||||||
|
except:
|
||||||
|
level = int(level[-1])
|
||||||
key = key.strip()
|
key = key.strip()
|
||||||
except:
|
except:
|
||||||
raise Errors.GedcomError("Corrupted file at line %d" % self.lcnt)
|
raise Errors.GedcomError("Corrupted file at line %d" % self.lcnt)
|
||||||
@ -362,7 +370,10 @@ class GedcomParser(UpdateCallback):
|
|||||||
if self.use_def_src:
|
if self.use_def_src:
|
||||||
self.def_src = RelLib.Source()
|
self.def_src = RelLib.Source()
|
||||||
fname = os.path.basename(filename).split('\\')[-1]
|
fname = os.path.basename(filename).split('\\')[-1]
|
||||||
self.def_src.set_title(_("Import from GEDCOM") % unicode(fname))
|
self.def_src.set_title(_("Import from GEDCOM (%s)") %
|
||||||
|
unicode(fname,
|
||||||
|
encoding=sys.getfilesystemencoding(),
|
||||||
|
errors='replace'))
|
||||||
self.dir_path = os.path.dirname(filename)
|
self.dir_path = os.path.dirname(filename)
|
||||||
self.is_ftw = False
|
self.is_ftw = False
|
||||||
self.is_ancestry_com = False
|
self.is_ancestry_com = False
|
||||||
|
@ -150,7 +150,7 @@ class IdMapper:
|
|||||||
def no_translate(self, gid):
|
def no_translate(self, gid):
|
||||||
return self.clean(gid)
|
return self.clean(gid)
|
||||||
|
|
||||||
def get_translate(self, id):
|
def get_translate(self, gid):
|
||||||
gid = self.clean(gid)
|
gid = self.clean(gid)
|
||||||
new_id = self.swap.has_key(gid)
|
new_id = self.swap.has_key(gid)
|
||||||
if new_id:
|
if new_id:
|
||||||
|
Reference in New Issue
Block a user