* src/GrampsDb/_ReadGedcom.py: handle illegal fullname gedcoms produced by FTM

* src/GrampsDb/_GedTokens.py: handle illegal fullname gedcoms produced by FTM


svn: r7664
This commit is contained in:
Don Allingham 2006-11-21 17:07:18 +00:00
parent 231f9a1277
commit 0d1f83d32b
3 changed files with 13 additions and 7 deletions

View File

@ -1,4 +1,6 @@
2006-11-21 Don Allingham <don@gramps-project.org> 2006-11-21 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: handle illegal fullname gedcoms produced by FTM
* src/GrampsDb/_GedTokens.py: handle illegal fullname gedcoms produced by FTM
* src/Utils.py (probably_alive): use get_primary_event_ref_list() * src/Utils.py (probably_alive): use get_primary_event_ref_list()
* src/RelLib/_Person.py: Add get_primary_event_ref_list() * src/RelLib/_Person.py: Add get_primary_event_ref_list()

View File

@ -134,6 +134,8 @@ TOKEN_RESN = 114
tokens = { tokens = {
"HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI, "HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI,
"HEADER" : TOKEN_HEAD, "TRAILER" : TOKEN_TRLR,
"CALL_NUMBER" : TOKEN_CALN, "MEDIA" : TOKEN_MEDI,
"CALN" : TOKEN_CALN, "ABBR" : TOKEN_ABBR, "CALN" : TOKEN_CALN, "ABBR" : TOKEN_ABBR,
"ABBREVIATION" : TOKEN_ABBR, "ADDR" : TOKEN_ADDR, "ABBREVIATION" : TOKEN_ABBR, "ADDR" : TOKEN_ADDR,
"ADDRESS" : TOKEN_ADDR, "ADOP" : TOKEN_ADOP, "ADDRESS" : TOKEN_ADDR, "ADOP" : TOKEN_ADOP,
@ -155,6 +157,7 @@ tokens = {
"CHILD" : TOKEN_CHIL, "CITY" : TOKEN_CITY, "CHILD" : TOKEN_CHIL, "CITY" : TOKEN_CITY,
"_COMM" : TOKEN__COMM, "CONC" : TOKEN_CONC, "_COMM" : TOKEN__COMM, "CONC" : TOKEN_CONC,
"CONCATENTATE" : TOKEN_CONC, "CONT" : TOKEN_CONT, "CONCATENTATE" : TOKEN_CONC, "CONT" : TOKEN_CONT,
"CONTINUED" : TOKEN_CONT, "CONCATENATION": TOKEN_CONC,
"CONTINUATION" : TOKEN_CONT, "COPR" : TOKEN_COPR, "CONTINUATION" : TOKEN_CONT, "COPR" : TOKEN_COPR,
"COPYRIGHT" : TOKEN_COPR, "CORP" : TOKEN_CORP, "COPYRIGHT" : TOKEN_COPR, "CORP" : TOKEN_CORP,
"CORPORATION" : TOKEN_CORP, "CTRY" : TOKEN_CTRY, "CORPORATION" : TOKEN_CORP, "CTRY" : TOKEN_CTRY,

View File

@ -1025,27 +1025,28 @@ class GedcomParser(UpdateCallback):
matches = self.get_next() matches = self.get_next()
key = matches[2].strip() key = matches[2].strip()
if matches[0] < 0 or matches[1] == TOKEN_TRLR: if matches[0] < 0 or matches[1] == TOKEN_TRLR:
self.backup()
break break
if key == "FAM": if key in ("FAM","FAMILY"):
self.parse_FAM(matches) self.parse_FAM(matches)
elif key == "INDI": elif key in ("INDI","INDIVIDUAL"):
self.parse_INDI(matches) self.parse_INDI(matches)
elif key == "OBJE": elif key in ("OBJE","OBJECT"):
self.parse_OBJE(matches) self.parse_OBJE(matches)
elif key == "REPO": elif key in ("REPO","REPOSITORY"):
self.repo_count += 1 self.repo_count += 1
self.repo = self.find_or_create_repository(matches[3][1:-1]) self.repo = self.find_or_create_repository(matches[3][1:-1])
self.added.add(self.repo.handle) self.added.add(self.repo.handle)
self.parse_repository(self.repo) self.parse_repository(self.repo)
self.db.commit_repository(self.repo, self.trans) self.db.commit_repository(self.repo, self.trans)
del self.repo del self.repo
elif key in ("SUBM", "SUBN"): elif key in ("SUBM", "SUBN", "SUBMITTER"):
self.ignore_sub_junk(1) self.ignore_sub_junk(1)
elif matches[1] in (TOKEN_SUBM, TOKEN_SUBN, TOKEN_IGNORE): elif matches[1] in (TOKEN_SUBM, TOKEN_SUBN, TOKEN_IGNORE):
self.ignore_sub_junk(1) self.ignore_sub_junk(1)
elif key == "SOUR": elif key in ("SOUR","SOURCE"):
self.parse_source(matches[3],1) self.parse_source(matches[3],1)
elif matches[2].startswith("SOUR "): elif matches[2].startswith("SOUR ") or matches[2].startswith("SOURCE "):
# A source formatted in a single line, for example: # A source formatted in a single line, for example:
# 0 @S62@ SOUR This is the title of the source # 0 @S62@ SOUR This is the title of the source
source = self.find_or_create_source(matches[3][1:-1]) source = self.find_or_create_source(matches[3][1:-1])