From b9c091a72e36d9a399e49fe29eb32bf5b618c0e1 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Wed, 28 Oct 2009 19:21:49 +0000 Subject: [PATCH] Bug 0003098: "Buri" event on GeneWeb file may break import into Gramps svn: r13449 --- src/plugins/import/ImportGeneWeb.py | 159 ++++++++++++++++------------ 1 file changed, 89 insertions(+), 70 deletions(-) diff --git a/src/plugins/import/ImportGeneWeb.py b/src/plugins/import/ImportGeneWeb.py index f02993541..57b19d052 100644 --- a/src/plugins/import/ImportGeneWeb.py +++ b/src/plugins/import/ImportGeneWeb.py @@ -426,46 +426,49 @@ class GeneWebParser(object): while idx < len(fields) and not (fields[idx] and fields[idx][0] == "+"): if fields[idx]: print "parse_marriage(): Unknown field: '%s' in line %d!" %(fields[idx],self.lineno) - idx = idx + 1 + idx += 1 while idx < len(fields) and mariageDataRe.match(fields[idx]): if fields[idx][0] == "+": mar_date = self.parse_date(self.decode(fields[idx])) self.debug(" Married at: %s" % fields[idx]) - idx = idx + 1 + idx += 1 elif fields[idx][0] == "-": div_date = self.parse_date(self.decode(fields[idx])) self.debug(" Div at: %s" % fields[idx]) - idx = idx + 1 + idx += 1 elif fields[idx] == "#mp": - idx = idx + 1 - mar_place = self.get_or_create_place(self.decode(fields[idx])) - self.debug(" Marriage place: %s" % fields[idx]) - idx = idx + 1 + idx += 1 + if idx < len(fields): + mar_place = self.get_or_create_place(self.decode(fields[idx])) + self.debug(" Marriage place: %s" % fields[idx]) + idx += 1 elif fields[idx] == "#ms": - idx = idx + 1 - mar_source = self.get_or_create_source(self.decode(fields[idx])) - self.debug(" Marriage source: %s" % fields[idx]) - idx = idx + 1 + idx += 1 + if idx < len(fields): + mar_source = self.get_or_create_source(self.decode(fields[idx])) + self.debug(" Marriage source: %s" % fields[idx]) + idx += 1 elif fields[idx] == "#sep": - idx = idx + 1 - sep_date = self.parse_date(self.decode(fields[idx])) - self.debug(" Seperated since: %s" % fields[idx]) - idx = idx + 1 + idx += 1 + if idx < len(fields): + sep_date = self.parse_date(self.decode(fields[idx])) + self.debug(" Seperated since: %s" % fields[idx]) + idx += 1 elif fields[idx] == "#nm": self.debug(" Are not married.") married = 0 - idx = idx + 1 + idx += 1 elif fields[idx] == "#noment": self.debug(" Not mentioned.") - idx = idx + 1 + idx += 1 elif fields[idx] == "#eng": self.debug(" Are engaged.") engaged = 1 - idx = idx + 1 + idx += 1 else: print "parse_marriage(): Unknown field '%s'for mariage in line %d!" % (fields[idx],self.lineno) - idx = idx + 1 + idx += 1 if mar_date or mar_place or mar_source: mar = self.create_event(gen.lib.EventType.MARRIAGE, None, mar_date, mar_place, mar_source) @@ -499,7 +502,7 @@ class GeneWebParser(object): surname ="" else: surname = self.decode(fields[idx]) - idx = idx + 1 + idx += 1 else: surname = father_surname @@ -508,12 +511,12 @@ class GeneWebParser(object): firstname = "" else: firstname = self.decode(fields[idx]) - idx = idx + 1 + idx += 1 if idx < len(fields) and father_surname: noSurnameRe = re.compile("^[({\[~>