diff --git a/ChangeLog b/ChangeLog index 64542bc48..4edef8d90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ 2006-06-07 Don Allingham * src/GrampsDb/_ReadGedcom.py: fix child/parent relationships + * src/GrampsDb/_GedTokens.py: handle some obscure tokens 2006-06-06 Don Allingham * src/GrampsDb/_ReadGedcom.py: read gedcoms that we write diff --git a/src/GrampsDb/_GedTokens.py b/src/GrampsDb/_GedTokens.py index f7127ba25..9b4b4f856 100644 --- a/src/GrampsDb/_GedTokens.py +++ b/src/GrampsDb/_GedTokens.py @@ -157,7 +157,7 @@ tokens = { "DESI" : TOKEN_DESI, "DEST" : TOKEN_DEST, "DESTINATION" : TOKEN_DEST, "ENDL" : TOKEN_ENDL, "ENDOWMENT" : TOKEN_ENDL, "EVEN" : TOKEN_EVEN, - "EVENT" : TOKEN_EVEN, + "EVENT" : TOKEN_EVEN, "_ANCES_ORDRE" : TOKEN_IGNORE, "FAM" : TOKEN_FAM, "FAMILY" : TOKEN_FAM, "FAMC" : TOKEN_FAMC, "FAMILY_CHILD" : TOKEN_FAMC, "FAMS" : TOKEN_FAMS, "FAMILY_SPOUSE" : TOKEN_FAMS, diff --git a/src/GrampsDb/_ReadGedcom.py b/src/GrampsDb/_ReadGedcom.py index 7f14d15e9..a3aaa239b 100644 --- a/src/GrampsDb/_ReadGedcom.py +++ b/src/GrampsDb/_ReadGedcom.py @@ -440,7 +440,13 @@ class Reader: break line = line.split(None,2) + [''] - val = line[2].translate(_transtable,_delc) + try: + val = line[2].translate(_transtable,_delc) + except IndexError: + msg = _("Invalid GEDCOM syntax at line %d was ignored.") % self.index + log.warningg(msg) + continue + try: val = self.cnv(val) except: @@ -1771,7 +1777,7 @@ class GedcomParser(UpdateCallback): self.def_src.set_publication_info(matches[2]) elif matches[1] == TOKEN_SUBM: self.parse_subm(2) - elif matches[1] in (TOKEN_CORP,TOKEN_DATA,TOKEN_SUBN,TOKEN_LANG): + elif matches[1] in (TOKEN_CORP, TOKEN_DATA, TOKEN_SUBN, TOKEN_LANG, TOKEN_TIME): self.ignore_sub_junk(2) elif matches[1] == TOKEN_DEST: if genby == "GRAMPS": @@ -2113,7 +2119,6 @@ class GedcomParser(UpdateCallback): while True: matches = self.get_next() - if self.level_is_finished(matches,2): if not ignore: state.person.add_person_ref(ref) @@ -2264,10 +2269,6 @@ class GedcomParser(UpdateCallback): ref.set_father_relation(ftype) family.add_child_ref(ref) self.db.commit_family(family, self.trans) - print "---------------" - print "p",state.person.handle, "f",family.handle - print state.person.parent_family_list - print [ ref.ref for ref in family.get_child_ref_list() ] def func_person_resi(self,matches,state): """