* src/GrampsDb/_GedTokens.py: handle some obscure tokens

svn: r6874
This commit is contained in:
Don Allingham 2006-06-08 04:51:45 +00:00
parent 4c16c41514
commit 81f86cefff
3 changed files with 10 additions and 8 deletions

View File

@ -4,6 +4,7 @@
2006-06-07 Don Allingham <don@gramps-project.org> 2006-06-07 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: fix child/parent relationships * src/GrampsDb/_ReadGedcom.py: fix child/parent relationships
* src/GrampsDb/_GedTokens.py: handle some obscure tokens
2006-06-06 Don Allingham <don@gramps-project.org> 2006-06-06 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: read gedcoms that we write * src/GrampsDb/_ReadGedcom.py: read gedcoms that we write

View File

@ -157,7 +157,7 @@ tokens = {
"DESI" : TOKEN_DESI, "DEST" : TOKEN_DEST, "DESI" : TOKEN_DESI, "DEST" : TOKEN_DEST,
"DESTINATION" : TOKEN_DEST, "ENDL" : TOKEN_ENDL, "DESTINATION" : TOKEN_DEST, "ENDL" : TOKEN_ENDL,
"ENDOWMENT" : TOKEN_ENDL, "EVEN" : TOKEN_EVEN, "ENDOWMENT" : TOKEN_ENDL, "EVEN" : TOKEN_EVEN,
"EVENT" : TOKEN_EVEN, "EVENT" : TOKEN_EVEN, "_ANCES_ORDRE" : TOKEN_IGNORE,
"FAM" : TOKEN_FAM, "FAMILY" : TOKEN_FAM, "FAM" : TOKEN_FAM, "FAMILY" : TOKEN_FAM,
"FAMC" : TOKEN_FAMC, "FAMILY_CHILD" : TOKEN_FAMC, "FAMC" : TOKEN_FAMC, "FAMILY_CHILD" : TOKEN_FAMC,
"FAMS" : TOKEN_FAMS, "FAMILY_SPOUSE" : TOKEN_FAMS, "FAMS" : TOKEN_FAMS, "FAMILY_SPOUSE" : TOKEN_FAMS,

View File

@ -440,7 +440,13 @@ class Reader:
break break
line = line.split(None,2) + [''] 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: try:
val = self.cnv(val) val = self.cnv(val)
except: except:
@ -1771,7 +1777,7 @@ class GedcomParser(UpdateCallback):
self.def_src.set_publication_info(matches[2]) self.def_src.set_publication_info(matches[2])
elif matches[1] == TOKEN_SUBM: elif matches[1] == TOKEN_SUBM:
self.parse_subm(2) 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) self.ignore_sub_junk(2)
elif matches[1] == TOKEN_DEST: elif matches[1] == TOKEN_DEST:
if genby == "GRAMPS": if genby == "GRAMPS":
@ -2113,7 +2119,6 @@ class GedcomParser(UpdateCallback):
while True: while True:
matches = self.get_next() matches = self.get_next()
if self.level_is_finished(matches,2): if self.level_is_finished(matches,2):
if not ignore: if not ignore:
state.person.add_person_ref(ref) state.person.add_person_ref(ref)
@ -2264,10 +2269,6 @@ class GedcomParser(UpdateCallback):
ref.set_father_relation(ftype) ref.set_father_relation(ftype)
family.add_child_ref(ref) family.add_child_ref(ref)
self.db.commit_family(family, self.trans) 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): def func_person_resi(self,matches,state):
""" """