From 4871ba35dba267d16b366c79ba20ec587061aa82 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 12 Jun 2006 04:51:11 +0000 Subject: [PATCH] 2006-06-11 Don Allingham * src/GrampsDb/_ReadGedcom.py: fix event parsing * src/GramspDb/_GedcomInfo.py: fix ORDN identification svn: r6882 --- ChangeLog | 4 ++++ src/GrampsDb/_GedcomInfo.py | 2 +- src/GrampsDb/_ReadGedcom.py | 42 +++++++++++++++++++++++++------------ 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1fa418d9..1aa912db4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-06-11 Don Allingham + * src/GrampsDb/_ReadGedcom.py: fix event parsing + * src/GramspDb/_GedcomInfo.py: fix ORDN identification + 2006-06-10 Don Allingham * src/GrampsDb/_ReadGedcom.py: fixes based of the gedcom torture test * src/GrampsDb/_GedTokeys.py: fixes based of the gedcom torture test diff --git a/src/GrampsDb/_GedcomInfo.py b/src/GrampsDb/_GedcomInfo.py index 00adcd46e..fe50eb72b 100644 --- a/src/GrampsDb/_GedcomInfo.py +++ b/src/GrampsDb/_GedcomInfo.py @@ -76,7 +76,7 @@ personalConstantEvents = { RelLib.EventType.BLESS : "BLES", RelLib.EventType.BURIAL : "BURI", RelLib.EventType.CAUSE_DEATH : "CAUS", - RelLib.EventType.ORDINATION : "ORDI", + RelLib.EventType.ORDINATION : "ORDN", RelLib.EventType.CENSUS : "CENS", RelLib.EventType.CHRISTEN : "CHR" , RelLib.EventType.CONFIRMATION : "CONF", diff --git a/src/GrampsDb/_ReadGedcom.py b/src/GrampsDb/_ReadGedcom.py index b613e91f1..b54a6b044 100644 --- a/src/GrampsDb/_ReadGedcom.py +++ b/src/GrampsDb/_ReadGedcom.py @@ -620,6 +620,7 @@ class GedcomParser(UpdateCallback): TOKEN__UID : self.func_person_attr, TOKEN_ASSO : self.func_person_asso, TOKEN_ANCI : self.skip_record, + TOKEN_SUBM : self.skip_record, TOKEN_DESI : self.skip_record, TOKEN_RIN : self.skip_record, TOKEN__TODO : self.skip_record, @@ -1464,6 +1465,7 @@ class GedcomParser(UpdateCallback): 'family' : Utils.family_name(self.family,self.db), } event.set_description(text) + self.db.add_event(event,self.trans) event_ref = RelLib.EventRef() @@ -1809,7 +1811,10 @@ class GedcomParser(UpdateCallback): name = RelLib.EventType((RelLib.EventType.CUSTOM,matches[3])) event.set_type(name) else: - event.set_description(matches[2]) + if not ged2gramps.has_key(matches[2]) and \ + not ged2fam.has_key(matches[2]) and \ + matches[2] != 'Y': + event.set_description(matches[2]) def func_event_privacy(self, matches, event, level): event.set_privacy(True) @@ -2870,6 +2875,7 @@ class GedcomParser(UpdateCallback): if matches[2]: event.set_description(matches[2]) person_event_name(event,state.person) + self.db.add_event(event, self.trans) event_ref = RelLib.EventRef() @@ -2889,18 +2895,28 @@ class GedcomParser(UpdateCallback): state.level+1,state.note)) def func_name_alia(self,matches,state): - aka = RelLib.Name() - try: - names = nameRegexp.match(matches[2]).groups() - except: - names = (matches[2],"","","","") - if names[0]: - aka.set_first_name(names[0].strip()) - if names[2]: - aka.set_surname(names[2].strip()) - if names[4]: - aka.set_suffix(names[4].strip()) - state.person.add_alternate_name(aka) + """ + The ALIA tag is supposed to cross reference another person. + However, we do not support this. + + Some systems use the ALIA tag as an alternate NAME tag, which + is not legal in GEDCOM, but oddly enough, is easy to support. + """ + if matches[2][0] == '@': + aka = RelLib.Name() + try: + names = nameRegexp.match(matches[2]).groups() + except: + names = (matches[2],"","","","") + if names[0]: + aka.set_first_name(names[0].strip()) + if names[2]: + aka.set_surname(names[2].strip()) + if names[4]: + aka.set_suffix(names[4].strip()) + state.person.add_alternate_name(aka) + else: + pass def func_name_npfx(self,matches,state): state.name.set_title(matches[2].strip())