From c79c5bfda0e7e3421ede5467f13eba3808f02796 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 6 Jan 2002 04:02:50 +0000 Subject: [PATCH] Fixed read/write gedcom bugs svn: r680 --- src/Find.py | 7 ++++++- src/plugins/ReadGedcom.py | 16 +++++++++++++++- src/plugins/WriteGedcom.py | 7 +++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Find.py b/src/Find.py index 7f2f02cd9..90212a3f8 100644 --- a/src/Find.py +++ b/src/Find.py @@ -114,7 +114,12 @@ class Find: last = self.clist.rows person = None while row != orow: - person,alt = self.clist.get_row_data(row) + value = self.clist.get_row_data(row) + if value == None: + row = row - 1 + continue + person = value[0] + alt = value[1] if alt == 0: name = person.getPrimaryName().getName() if string.find(string.upper(name),string.upper(text)) >= 0: diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index e3b32f671..1d8978923 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -662,7 +662,21 @@ class GedcomParser: self.person.addAttribute(attr) else: self.person.addEvent(event) - elif matches[1] in ["AFN","CHAN","REFN","SOUR","ASSO"]: + elif matches[1] == "SOUR": + source_ref = SourceRef() + if matches[2] and matches[2][0] != "@": + self.localref = self.localref + 1 + ref = "gsr%d" % self.localref + s = self.db.findSource(ref,self.smap) + source_ref.setBase(s) + s.setTitle('Imported Source #%d' % self.localref) + s.setNote(matches[2] + self.parse_continue_data(2)) + self.ignore_sub_junk(2) + else: + source_ref.setBase(self.db.findSource(matches[2],self.smap)) + self.parse_source_reference(source_ref,2) + self.person.getPrimaryName().addSourceRef(source_ref) + elif matches[1] in ["AFN","CHAN","REFN","ASSO"]: self.ignore_sub_junk(2) elif matches[1] in ["ANCI","DESI","RIN","RFN"]: pass diff --git a/src/plugins/WriteGedcom.py b/src/plugins/WriteGedcom.py index deba71f4f..4cdf7a59d 100644 --- a/src/plugins/WriteGedcom.py +++ b/src/plugins/WriteGedcom.py @@ -207,6 +207,7 @@ def add_persons_sources(person,slist,private): sbase = source_ref.getBase() if sbase != None and sbase not in slist: slist.append(sbase) + for event in person.getAddressList(): if private and event.getPrivacy(): continue @@ -214,14 +215,16 @@ def add_persons_sources(person,slist,private): sbase = source_ref.getBase() if sbase != None and sbase not in slist: slist.append(sbase) - for event in person.getAttibuteList: + + for event in person.getAttibuteList(): if private and event.getPrivacy(): continue for source_ref in event.getSourceRefList(): sbase = source_ref.getBase() if sbase != None and sbase not in slist: slist.append(sbase) - for name in person.getNameList + [person.getPrimaryName()]: + + for name in person.getNameList() + [person.getPrimaryName()]: if private and name.getPrivacy(): continue for source_ref in name.getSourceRefList():