From 88ac40491c18ba45c814481f94a222df73bb5a72 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 28 May 2002 13:58:03 +0000 Subject: [PATCH] Fixed level problem with GEDCOM import, fixed ZODB detection svn: r1011 --- src/gramps_main.py | 7 +++---- src/plugins/ReadGedcom.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/gramps_main.py b/src/gramps_main.py index 5ebe1600b..e57f7852b 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -77,10 +77,9 @@ import ReadXML from GrampsXML import GrampsXML try: from GrampsZODB import GrampsZODB - USE_ZODB = 1 + zodb_ok = 1 except: - USE_ZODB = 0 - + zodb_ok = 0 #------------------------------------------------------------------------- # @@ -1799,7 +1798,7 @@ class Gramps: def load_database(self,name): filename = "%s/%s" % (name,const.xmlFile) - if not os.path.isfile(filename): + if not os.path.isfile(filename) and zodb_ok: filename = "%s/%s" % (name,const.zodbFile) self.clear_database(1) else: diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index f0902911e..9c2020947 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -459,7 +459,7 @@ class GedcomParser: self.backup() return elif matches[1] == "SOUR": - event.addSourceRef(self.handle_source(matches)) + event.addSourceRef(self.handle_source(matches,level)) else: self.barf(1) @@ -742,7 +742,7 @@ class GedcomParser: else: self.person.addEvent(event) elif matches[1] == "SOUR": - source_ref = self.handle_source(matches) + source_ref = self.handle_source(matches,2) self.person.getPrimaryName().addSourceRef(source_ref) elif matches[1] == "REFN": if intRE.match(matches[2]): @@ -1026,7 +1026,7 @@ class GedcomParser: except NameError: print 'please fix the val NameError' elif matches[1] == "SOUR": - ord.addSourceRef(self.handle_source(matches)) + ord.addSourceRef(self.handle_source(matches,level)) elif matches[1] == "NOTE": if matches[2] and matches[2][0] != "@": note = matches[2] + self.parse_continue_data(level+1) @@ -1072,7 +1072,7 @@ class GedcomParser: elif matches[1] in ["TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]: self.ignore_sub_junk(level+1) elif matches[1] == "SOUR": - event.addSourceRef(self.handle_source(matches)) + event.addSourceRef(self.handle_source(matches,level)) elif matches[1] == "PLAC": val = matches[2] n = string.strip(event.getName()) @@ -1126,7 +1126,7 @@ class GedcomParser: elif matches[1] in ["TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]: self.ignore_sub_junk(level+1) elif matches[1] == "SOUR": - event.addSourceRef(self.handle_source(matches)) + event.addSourceRef(self.handle_source(matches,level)) elif matches[1] == "FAMC": family = self.db.findFamily(matches[2],self.fmap) mrel,frel = self.parse_adopt_famc(level+1); @@ -1206,7 +1206,7 @@ class GedcomParser: elif matches[1] in ["CAUS", "DATE","TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE"]: self.ignore_sub_junk(level+1) elif matches[1] == "SOUR": - attr.addSourceRef(self.handle_source(matches)) + attr.addSourceRef(self.handle_source(matches,level)) elif matches[1] == "PLAC": val = matches[2] if attr.getValue() == "": @@ -1253,7 +1253,7 @@ class GedcomParser: elif matches[1] in ["TIME","AGE","AGNC","ADDR","STAT","TEMP","HUSB","WIFE","OBJE","_CHUR"]: self.ignore_sub_junk(level+1) elif matches[1] == "SOUR": - event.addSourceRef(self.handle_source(matches)) + event.addSourceRef(self.handle_source(matches,level)) elif matches[1] == "PLAC": val = matches[2] if self.placemap.has_key(val): @@ -1634,7 +1634,7 @@ class GedcomParser: return dateobj - def handle_source(self,matches): + def handle_source(self,matches,level): source_ref = SourceRef() if matches[2] and matches[2][0] != "@": self.localref = self.localref + 1