* src/plugins/ReadGedcom.py: Correct level in parsing LDS ordinance
source references. Support for source description-type references. svn: r2586
This commit is contained in:
parent
8bf5f5b12a
commit
2a92fac355
@ -1,3 +1,7 @@
|
|||||||
|
2004-01-04 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
|
* src/plugins/ReadGedcom.py: Correct level in parsing LDS ordinance
|
||||||
|
source references. Support for source description-type references.
|
||||||
|
|
||||||
2004-01-03 Alex Roitman <shura@alex.neuro.umn.edu>
|
2004-01-03 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/po/fr.po: Typo (named format line parameter was translated).
|
* src/po/fr.po: Typo (named format line parameter was translated).
|
||||||
|
|
||||||
|
@ -259,6 +259,7 @@ class GedcomParser:
|
|||||||
self.update(self.file_obj,os.path.basename(file))
|
self.update(self.file_obj,os.path.basename(file))
|
||||||
|
|
||||||
self.search_paths = []
|
self.search_paths = []
|
||||||
|
self.source_description=""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mypaths = []
|
mypaths = []
|
||||||
@ -364,7 +365,7 @@ class GedcomParser:
|
|||||||
|
|
||||||
def barf(self,level):
|
def barf(self,level):
|
||||||
import traceback
|
import traceback
|
||||||
msg = _("Warning: line %d was not understood, so it was ignored.") % self.index
|
msg = _("Warning: line %d was not understood, so it was ignored.") % self.index
|
||||||
self.errmsg(msg)
|
self.errmsg(msg)
|
||||||
msg = "\n\t%s\n" % self.text
|
msg = "\n\t%s\n" % self.text
|
||||||
|
|
||||||
@ -413,22 +414,22 @@ class GedcomParser:
|
|||||||
o.unique_note()
|
o.unique_note()
|
||||||
|
|
||||||
def parse_trailer(self):
|
def parse_trailer(self):
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if matches[1] != "TRLR":
|
if matches[1] != "TRLR":
|
||||||
self.barf(0)
|
self.barf(0)
|
||||||
self.f.close()
|
self.f.close()
|
||||||
|
|
||||||
def parse_header(self):
|
def parse_header(self):
|
||||||
self.parse_header_head()
|
self.parse_header_head()
|
||||||
self.parse_header_source()
|
self.parse_header_source()
|
||||||
|
|
||||||
def parse_submitter(self):
|
def parse_submitter(self):
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if matches[2] != "SUBM":
|
if matches[2] != "SUBM":
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.ignore_sub_junk(1)
|
self.ignore_sub_junk(1)
|
||||||
|
|
||||||
@ -438,7 +439,7 @@ class GedcomParser:
|
|||||||
note = ""
|
note = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
if note:
|
if note:
|
||||||
self.source.setNote(note)
|
self.source.setNote(note)
|
||||||
if not self.source.getTitle():
|
if not self.source.getTitle():
|
||||||
@ -479,7 +480,7 @@ class GedcomParser:
|
|||||||
|
|
||||||
def parse_record(self):
|
def parse_record(self):
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if matches[2] == "FAM":
|
if matches[2] == "FAM":
|
||||||
if self.fam_count % UPDATE == 0 and self.window:
|
if self.fam_count % UPDATE == 0 and self.window:
|
||||||
self.update(self.families_obj,str(self.fam_count))
|
self.update(self.families_obj,str(self.fam_count))
|
||||||
@ -521,11 +522,11 @@ class GedcomParser:
|
|||||||
# noteobj.append(text + self.parse_continue_data(1))
|
# noteobj.append(text + self.parse_continue_data(1))
|
||||||
noteobj.append(text + self.parse_note_continue(1))
|
noteobj.append(text + self.parse_note_continue(1))
|
||||||
self.parse_note_data(1)
|
self.parse_note_data(1)
|
||||||
elif matches[1] == "TRLR":
|
elif matches[1] == "TRLR":
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.barf(1)
|
self.barf(1)
|
||||||
|
|
||||||
def find_or_create_person(self,id):
|
def find_or_create_person(self,id):
|
||||||
if self.pmap.has_key(id):
|
if self.pmap.has_key(id):
|
||||||
@ -542,18 +543,18 @@ class GedcomParser:
|
|||||||
def parse_cause(self,event,level):
|
def parse_cause(self,event,level):
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] == "SOUR":
|
elif matches[1] == "SOUR":
|
||||||
event.addSourceRef(self.handle_source(matches,level))
|
event.addSourceRef(self.handle_source(matches,level))
|
||||||
else:
|
else:
|
||||||
self.barf(1)
|
self.barf(1)
|
||||||
|
|
||||||
def parse_note_data(self,level):
|
def parse_note_data(self,level):
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] in ["SOUR","CHAN","REFN"]:
|
elif matches[1] in ["SOUR","CHAN","REFN"]:
|
||||||
@ -569,7 +570,7 @@ class GedcomParser:
|
|||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return (mrel,frel)
|
return (mrel,frel)
|
||||||
# FTW
|
# FTW
|
||||||
@ -597,30 +598,30 @@ class GedcomParser:
|
|||||||
self.addr = None
|
self.addr = None
|
||||||
note = ""
|
note = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) == 0:
|
if int(matches[0]) == 0:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] == "HUSB":
|
elif matches[1] == "HUSB":
|
||||||
id = matches[2]
|
id = matches[2]
|
||||||
person = self.find_or_create_person(id[1:-1])
|
person = self.find_or_create_person(id[1:-1])
|
||||||
self.family.setFather(person)
|
self.family.setFather(person)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "WIFE":
|
elif matches[1] == "WIFE":
|
||||||
id = matches[2]
|
id = matches[2]
|
||||||
person = self.find_or_create_person(id[1:-1])
|
person = self.find_or_create_person(id[1:-1])
|
||||||
self.family.setMother(person)
|
self.family.setMother(person)
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "SLGS":
|
elif matches[1] == "SLGS":
|
||||||
ord = RelLib.LdsOrd()
|
ord = RelLib.LdsOrd()
|
||||||
self.family.setLdsSeal(ord)
|
self.family.setLdsSeal(ord)
|
||||||
self.parse_ord(ord,2)
|
self.parse_ord(ord,2)
|
||||||
elif matches[1] == "ADDR":
|
elif matches[1] == "ADDR":
|
||||||
self.addr = RelLib.Address()
|
self.addr = RelLib.Address()
|
||||||
self.addr.setStreet(matches[2] + self.parse_continue_data(1))
|
self.addr.setStreet(matches[2] + self.parse_continue_data(1))
|
||||||
self.parse_address(self.addr,2)
|
self.parse_address(self.addr,2)
|
||||||
elif matches[1] == "CHIL":
|
elif matches[1] == "CHIL":
|
||||||
mrel,frel = self.parse_ftw_relations(2)
|
mrel,frel = self.parse_ftw_relations(2)
|
||||||
id = matches[2]
|
id = matches[2]
|
||||||
child = self.find_or_create_person(id[1:-1])
|
child = self.find_or_create_person(id[1:-1])
|
||||||
@ -636,14 +637,14 @@ class GedcomParser:
|
|||||||
if child.getMainParents() == self.family:
|
if child.getMainParents() == self.family:
|
||||||
child.setMainParents(None)
|
child.setMainParents(None)
|
||||||
child.addAltFamily(self.family,mrel,frel)
|
child.addAltFamily(self.family,mrel,frel)
|
||||||
elif matches[1] == "NCHI":
|
elif matches[1] == "NCHI":
|
||||||
a = RelLib.Attribute()
|
a = RelLib.Attribute()
|
||||||
a.setType("Number of Children")
|
a.setType("Number of Children")
|
||||||
a.setValue(matches[2])
|
a.setValue(matches[2])
|
||||||
self.family.addAttribute(a)
|
self.family.addAttribute(a)
|
||||||
elif matches[1] in ["RIN", "SUBM", "REFN","CHAN","SOUR"]:
|
elif matches[1] in ["RIN", "SUBM", "REFN","CHAN","SOUR"]:
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "OBJE":
|
elif matches[1] == "OBJE":
|
||||||
if matches[2] and matches[2][0] == '@':
|
if matches[2] and matches[2][0] == '@':
|
||||||
self.barf(2)
|
self.barf(2)
|
||||||
else:
|
else:
|
||||||
@ -663,7 +664,7 @@ class GedcomParser:
|
|||||||
if event.getName() == "Marriage":
|
if event.getName() == "Marriage":
|
||||||
self.family.setRelationship("Married")
|
self.family.setRelationship("Married")
|
||||||
self.family.addEvent(event)
|
self.family.addEvent(event)
|
||||||
self.parse_family_event(event,2)
|
self.parse_family_event(event,2)
|
||||||
|
|
||||||
def parse_note_base(self,matches,obj,level,old_note,task):
|
def parse_note_base(self,matches,obj,level,old_note,task):
|
||||||
note = old_note
|
note = old_note
|
||||||
@ -695,12 +696,12 @@ class GedcomParser:
|
|||||||
name_cnt = 0
|
name_cnt = 0
|
||||||
note = ""
|
note = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) == 0:
|
if int(matches[0]) == 0:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] == "NAME":
|
elif matches[1] == "NAME":
|
||||||
name = RelLib.Name()
|
name = RelLib.Name()
|
||||||
m = snameRegexp.match(matches[2])
|
m = snameRegexp.match(matches[2])
|
||||||
if m:
|
if m:
|
||||||
@ -740,21 +741,21 @@ class GedcomParser:
|
|||||||
if names[4]:
|
if names[4]:
|
||||||
aka.setSuffix(names[4])
|
aka.setSuffix(names[4])
|
||||||
self.person.addAlternateName(aka)
|
self.person.addAlternateName(aka)
|
||||||
elif matches[1] == "OBJE":
|
elif matches[1] == "OBJE":
|
||||||
if matches[2] and matches[2][0] == '@':
|
if matches[2] and matches[2][0] == '@':
|
||||||
self.barf(2)
|
self.barf(2)
|
||||||
else:
|
else:
|
||||||
self.parse_person_object(2)
|
self.parse_person_object(2)
|
||||||
elif matches[1] in ["NOTE","_COMM"]:
|
elif matches[1] in ["NOTE","_COMM"]:
|
||||||
note = self.parse_note(matches,self.person,1,note)
|
note = self.parse_note(matches,self.person,1,note)
|
||||||
elif matches[1] == "SEX":
|
elif matches[1] == "SEX":
|
||||||
if matches[2] == '':
|
if matches[2] == '':
|
||||||
self.person.setGender(RelLib.Person.unknown)
|
self.person.setGender(RelLib.Person.unknown)
|
||||||
elif matches[2][0] == "M":
|
elif matches[2][0] == "M":
|
||||||
self.person.setGender(RelLib.Person.male)
|
self.person.setGender(RelLib.Person.male)
|
||||||
else:
|
else:
|
||||||
self.person.setGender(RelLib.Person.female)
|
self.person.setGender(RelLib.Person.female)
|
||||||
elif matches[1] in [ "BAPL", "ENDL", "SLGC" ]:
|
elif matches[1] in [ "BAPL", "ENDL", "SLGC" ]:
|
||||||
ord = RelLib.LdsOrd()
|
ord = RelLib.LdsOrd()
|
||||||
if matches[1] == "BAPL":
|
if matches[1] == "BAPL":
|
||||||
self.person.setLdsBaptism(ord)
|
self.person.setLdsBaptism(ord)
|
||||||
@ -763,14 +764,14 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
self.person.setLdsSeal(ord)
|
self.person.setLdsSeal(ord)
|
||||||
self.parse_ord(ord,2)
|
self.parse_ord(ord,2)
|
||||||
elif matches[1] == "FAMS":
|
elif matches[1] == "FAMS":
|
||||||
family = self.db.findFamily(matches[2],self.fmap)
|
family = self.db.findFamily(matches[2],self.fmap)
|
||||||
self.person.addFamily(family)
|
self.person.addFamily(family)
|
||||||
if note == "":
|
if note == "":
|
||||||
note = self.parse_optional_note(2)
|
note = self.parse_optional_note(2)
|
||||||
else:
|
else:
|
||||||
note = "%s\n\n%s" % (note,self.parse_optional_note(2))
|
note = "%s\n\n%s" % (note,self.parse_optional_note(2))
|
||||||
elif matches[1] == "FAMC":
|
elif matches[1] == "FAMC":
|
||||||
type,note = self.parse_famc_type(2)
|
type,note = self.parse_famc_type(2)
|
||||||
family = self.db.findFamily(matches[2],self.fmap)
|
family = self.db.findFamily(matches[2],self.fmap)
|
||||||
|
|
||||||
@ -787,11 +788,11 @@ class GedcomParser:
|
|||||||
if self.person.getMainParents() == family:
|
if self.person.getMainParents() == family:
|
||||||
self.person.setMainParents(None)
|
self.person.setMainParents(None)
|
||||||
self.person.addAltFamily(family,type,type)
|
self.person.addAltFamily(family,type,type)
|
||||||
elif matches[1] == "RESI":
|
elif matches[1] == "RESI":
|
||||||
addr = RelLib.Address()
|
addr = RelLib.Address()
|
||||||
self.person.addAddress(addr)
|
self.person.addAddress(addr)
|
||||||
self.parse_residence(addr,2)
|
self.parse_residence(addr,2)
|
||||||
elif matches[1] == "ADDR":
|
elif matches[1] == "ADDR":
|
||||||
addr = RelLib.Address()
|
addr = RelLib.Address()
|
||||||
addr.setStreet(matches[2] + self.parse_continue_data(1))
|
addr.setStreet(matches[2] + self.parse_continue_data(1))
|
||||||
self.parse_address(addr,2)
|
self.parse_address(addr,2)
|
||||||
@ -801,7 +802,7 @@ class GedcomParser:
|
|||||||
addr.setStreet("Unknown")
|
addr.setStreet("Unknown")
|
||||||
addr.setPhone(matches[2])
|
addr.setPhone(matches[2])
|
||||||
self.person.addAddress(addr)
|
self.person.addAddress(addr)
|
||||||
elif matches[1] == "BIRT":
|
elif matches[1] == "BIRT":
|
||||||
event = RelLib.Event()
|
event = RelLib.Event()
|
||||||
if self.person.getBirth().getDate() != "" or \
|
if self.person.getBirth().getDate() != "" or \
|
||||||
self.person.getBirth().getPlace() != None:
|
self.person.getBirth().getPlace() != None:
|
||||||
@ -811,12 +812,12 @@ class GedcomParser:
|
|||||||
event.setName("Birth")
|
event.setName("Birth")
|
||||||
self.person.setBirth(event)
|
self.person.setBirth(event)
|
||||||
self.parse_person_event(event,2)
|
self.parse_person_event(event,2)
|
||||||
elif matches[1] == "ADOP":
|
elif matches[1] == "ADOP":
|
||||||
event = RelLib.Event()
|
event = RelLib.Event()
|
||||||
event.setName("Adopted")
|
event.setName("Adopted")
|
||||||
self.person.addEvent(event)
|
self.person.addEvent(event)
|
||||||
self.parse_adopt_event(event,2)
|
self.parse_adopt_event(event,2)
|
||||||
elif matches[1] == "DEAT":
|
elif matches[1] == "DEAT":
|
||||||
event = RelLib.Event()
|
event = RelLib.Event()
|
||||||
if self.person.getDeath().getDate() != "" or \
|
if self.person.getDeath().getDate() != "" or \
|
||||||
self.person.getDeath().getPlace() != None:
|
self.person.getDeath().getPlace() != None:
|
||||||
@ -826,9 +827,9 @@ class GedcomParser:
|
|||||||
event.setName("Death")
|
event.setName("Death")
|
||||||
self.person.setDeath(event)
|
self.person.setDeath(event)
|
||||||
self.parse_person_event(event,2)
|
self.parse_person_event(event,2)
|
||||||
elif matches[1] == "EVEN":
|
elif matches[1] == "EVEN":
|
||||||
event = RelLib.Event()
|
event = RelLib.Event()
|
||||||
self.parse_person_event(event,2)
|
self.parse_person_event(event,2)
|
||||||
n = string.strip(event.getName())
|
n = string.strip(event.getName())
|
||||||
if n in self.attrs:
|
if n in self.attrs:
|
||||||
attr = RelLib.Attribute()
|
attr = RelLib.Attribute()
|
||||||
@ -840,15 +841,15 @@ class GedcomParser:
|
|||||||
elif matches[1] == "SOUR":
|
elif matches[1] == "SOUR":
|
||||||
source_ref = self.handle_source(matches,2)
|
source_ref = self.handle_source(matches,2)
|
||||||
self.person.getPrimaryName().addSourceRef(source_ref)
|
self.person.getPrimaryName().addSourceRef(source_ref)
|
||||||
elif matches[1] == "REFN":
|
elif matches[1] == "REFN":
|
||||||
if intRE.match(matches[2]):
|
if intRE.match(matches[2]):
|
||||||
try:
|
try:
|
||||||
self.refn[self.person.getId()] = int(matches[2])
|
self.refn[self.person.getId()] = int(matches[2])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
elif matches[1] in ["AFN","CHAN","REFN","ASSO"]:
|
elif matches[1] in ["AFN","CHAN","REFN","ASSO"]:
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] in ["ANCI","DESI","RIN","RFN"]:
|
elif matches[1] in ["ANCI","DESI","RIN","RFN"]:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
event = RelLib.Event()
|
event = RelLib.Event()
|
||||||
@ -869,7 +870,7 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
event.setName(n)
|
event.setName(n)
|
||||||
|
|
||||||
self.parse_person_event(event,2)
|
self.parse_person_event(event,2)
|
||||||
if matches[2]:
|
if matches[2]:
|
||||||
event.setDescription(matches[2])
|
event.setDescription(matches[2])
|
||||||
self.person.addEvent(event)
|
self.person.addEvent(event)
|
||||||
@ -879,7 +880,7 @@ class GedcomParser:
|
|||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return note
|
return note
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
@ -889,7 +890,7 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_famc_type(self,level):
|
def parse_famc_type(self,level):
|
||||||
type = ""
|
type = ""
|
||||||
@ -897,7 +898,7 @@ class GedcomParser:
|
|||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return (string.capitalize(type),note)
|
return (string.capitalize(type),note)
|
||||||
elif matches[1] == "PEDI":
|
elif matches[1] == "PEDI":
|
||||||
@ -914,7 +915,7 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_person_object(self,level):
|
def parse_person_object(self,level):
|
||||||
form = ""
|
form = ""
|
||||||
@ -933,11 +934,11 @@ class GedcomParser:
|
|||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data(level+1)
|
||||||
elif matches[1][0] == "_":
|
elif matches[1][0] == "_":
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif int(matches[0]) < level:
|
elif int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
if form == "url":
|
if form == "url":
|
||||||
url = RelLib.Url()
|
url = RelLib.Url()
|
||||||
@ -976,11 +977,11 @@ class GedcomParser:
|
|||||||
file = matches[2]
|
file = matches[2]
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data(level+1)
|
||||||
elif int(matches[0]) < level:
|
elif int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
if form:
|
if form:
|
||||||
(ok,path) = self.find_file(file,self.dir_path)
|
(ok,path) = self.find_file(file,self.dir_path)
|
||||||
@ -1014,11 +1015,11 @@ class GedcomParser:
|
|||||||
file = matches[2]
|
file = matches[2]
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data(level+1)
|
||||||
elif int(matches[0]) < level:
|
elif int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
if form:
|
if form:
|
||||||
(ok,path) = self.find_file(file,self.dir_path)
|
(ok,path) = self.find_file(file,self.dir_path)
|
||||||
@ -1047,7 +1048,7 @@ class GedcomParser:
|
|||||||
return
|
return
|
||||||
elif matches[1] == "DATE":
|
elif matches[1] == "DATE":
|
||||||
address.setDateObj(self.extract_date(matches[2]))
|
address.setDateObj(self.extract_date(matches[2]))
|
||||||
elif matches[1] == "ADDR":
|
elif matches[1] == "ADDR":
|
||||||
address.setStreet(matches[2] + self.parse_continue_data(level+1))
|
address.setStreet(matches[2] + self.parse_continue_data(level+1))
|
||||||
self.parse_address(address,level+1)
|
self.parse_address(address,level+1)
|
||||||
elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE","_DATE2"]:
|
elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE","_DATE2"]:
|
||||||
@ -1056,6 +1057,7 @@ class GedcomParser:
|
|||||||
source_ref = RelLib.SourceRef()
|
source_ref = RelLib.SourceRef()
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
address.addSourceRef(source_ref)
|
address.addSourceRef(source_ref)
|
||||||
|
self.source_description = matches[2]
|
||||||
self.parse_source_reference(source_ref,level+1)
|
self.parse_source_reference(source_ref,level+1)
|
||||||
elif matches[1] == "PLAC":
|
elif matches[1] == "PLAC":
|
||||||
address.setStreet(matches[2])
|
address.setStreet(matches[2])
|
||||||
@ -1066,14 +1068,14 @@ class GedcomParser:
|
|||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = self.parse_note(matches,address,level+1,note)
|
note = self.parse_note(matches,address,level+1,note)
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_address(self,address,level):
|
def parse_address(self,address,level):
|
||||||
first = 0
|
first = 0
|
||||||
note = ""
|
note = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
if matches[1] == "PHON":
|
if matches[1] == "PHON":
|
||||||
address.setPhone(matches[2])
|
address.setPhone(matches[2])
|
||||||
else:
|
else:
|
||||||
@ -1097,7 +1099,7 @@ class GedcomParser:
|
|||||||
elif matches[1] == "CTRY":
|
elif matches[1] == "CTRY":
|
||||||
address.setCountry(matches[2])
|
address.setCountry(matches[2])
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_ord(self,ord,level):
|
def parse_ord(self,ord,level):
|
||||||
note = ""
|
note = ""
|
||||||
@ -1127,7 +1129,7 @@ class GedcomParser:
|
|||||||
except NameError:
|
except NameError:
|
||||||
pass
|
pass
|
||||||
elif matches[1] == "SOUR":
|
elif matches[1] == "SOUR":
|
||||||
ord.addSourceRef(self.handle_source(matches,level))
|
ord.addSourceRef(self.handle_source(matches,level+1))
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = self.parse_note(matches,ord,level+1,note)
|
note = self.parse_note(matches,ord,level+1,note)
|
||||||
elif matches[1] == "STAT":
|
elif matches[1] == "STAT":
|
||||||
@ -1186,18 +1188,18 @@ class GedcomParser:
|
|||||||
note = info
|
note = info
|
||||||
else:
|
else:
|
||||||
note = "\n%s" % info
|
note = "\n%s" % info
|
||||||
elif matches[1] == "CONC":
|
elif matches[1] == "CONC":
|
||||||
d = event.getDescription()
|
d = event.getDescription()
|
||||||
if self.broken_conc:
|
if self.broken_conc:
|
||||||
event.setDescription("%s %s" % (d, matches[2]))
|
event.setDescription("%s %s" % (d, matches[2]))
|
||||||
else:
|
else:
|
||||||
event.setDescription("%s%s" % (d, matches[2]))
|
event.setDescription("%s%s" % (d, matches[2]))
|
||||||
elif matches[1] == "CONT":
|
elif matches[1] == "CONT":
|
||||||
event.setDescription("%s\n%s" % (event.getDescription(),matches[2]))
|
event.setDescription("%s\n%s" % (event.getDescription(),matches[2]))
|
||||||
elif matches[1] in ["RELI", "TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE","_DATE2"]:
|
elif matches[1] in ["RELI", "TIME","ADDR","AGE","AGNC","STAT","TEMP","OBJE","_DATE2"]:
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_adopt_event(self,event,level):
|
def parse_adopt_event(self,event,level):
|
||||||
note = ""
|
note = ""
|
||||||
@ -1244,17 +1246,17 @@ class GedcomParser:
|
|||||||
note = info
|
note = info
|
||||||
else:
|
else:
|
||||||
note = "\n%s" % info
|
note = "\n%s" % info
|
||||||
elif matches[1] == "CONC":
|
elif matches[1] == "CONC":
|
||||||
d = event.getDescription()
|
d = event.getDescription()
|
||||||
if self.broken_conc:
|
if self.broken_conc:
|
||||||
event.setDescription("%s %s" % (d,matches[2]))
|
event.setDescription("%s %s" % (d,matches[2]))
|
||||||
else:
|
else:
|
||||||
event.setDescription("%s%s" % (d,matches[2]))
|
event.setDescription("%s%s" % (d,matches[2]))
|
||||||
elif matches[1] == "CONT":
|
elif matches[1] == "CONT":
|
||||||
d = event.getDescription()
|
d = event.getDescription()
|
||||||
event.setDescription("%s\n%s" % (d,matches[2]))
|
event.setDescription("%s\n%s" % (d,matches[2]))
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_adopt_famc(self,level):
|
def parse_adopt_famc(self,level):
|
||||||
mrel = "Adopted"
|
mrel = "Adopted"
|
||||||
@ -1270,7 +1272,7 @@ class GedcomParser:
|
|||||||
elif matches[2] == "WIFE":
|
elif matches[2] == "WIFE":
|
||||||
frel = "Birth"
|
frel = "Birth"
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_person_attr(self,attr,level):
|
def parse_person_attr(self,attr,level):
|
||||||
note = ""
|
note = ""
|
||||||
@ -1299,7 +1301,7 @@ class GedcomParser:
|
|||||||
if attr.getValue() == "":
|
if attr.getValue() == "":
|
||||||
attr.setValue(val)
|
attr.setValue(val)
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
elif matches[1] == "DATE":
|
elif matches[1] == "DATE":
|
||||||
note = "%s\n\n" % ("Date : %s" % matches[2])
|
note = "%s\n\n" % ("Date : %s" % matches[2])
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
info = matches[2] + self.parse_continue_data(level+1)
|
info = matches[2] + self.parse_continue_data(level+1)
|
||||||
@ -1307,15 +1309,15 @@ class GedcomParser:
|
|||||||
note = info
|
note = info
|
||||||
else:
|
else:
|
||||||
note = "%s\n\n%s" % (note,info)
|
note = "%s\n\n%s" % (note,info)
|
||||||
elif matches[1] == "CONC":
|
elif matches[1] == "CONC":
|
||||||
if self.broken_conc:
|
if self.broken_conc:
|
||||||
attr.setValue("%s %s" % (attr.getValue(), matches[2]))
|
attr.setValue("%s %s" % (attr.getValue(), matches[2]))
|
||||||
else:
|
else:
|
||||||
attr.setValue("%s %s" % (attr.getValue(), matches[2]))
|
attr.setValue("%s %s" % (attr.getValue(), matches[2]))
|
||||||
elif matches[1] == "CONT":
|
elif matches[1] == "CONT":
|
||||||
attr.setValue("%s\n%s" % (attr.getValue(),matches[2]))
|
attr.setValue("%s\n%s" % (attr.getValue(),matches[2]))
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
if note != "":
|
if note != "":
|
||||||
attr.setNote(note)
|
attr.setNote(note)
|
||||||
|
|
||||||
@ -1366,7 +1368,7 @@ class GedcomParser:
|
|||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = self.parse_note(matches,event,level+1,note)
|
note = self.parse_note(matches,event,level+1,note)
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_source_reference(self,source,level):
|
def parse_source_reference(self,source,level):
|
||||||
"""Reads the data associated with a SOUR reference"""
|
"""Reads the data associated with a SOUR reference"""
|
||||||
@ -1374,9 +1376,13 @@ class GedcomParser:
|
|||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
|
elif matches[1] in ["CONC", "CONT"]:
|
||||||
|
self.backup()
|
||||||
|
self.parse_source_description(source,level)
|
||||||
|
return
|
||||||
elif matches[1] == "PAGE":
|
elif matches[1] == "PAGE":
|
||||||
source.setPage(matches[2] + self.parse_continue_data(level+1))
|
source.setPage(matches[2] + self.parse_continue_data(level+1))
|
||||||
elif matches[1] == "DATA":
|
elif matches[1] == "DATA":
|
||||||
@ -1396,15 +1402,38 @@ class GedcomParser:
|
|||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = self.parse_comment(matches,source,level+1,note)
|
note = self.parse_comment(matches,source,level+1,note)
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
|
def parse_source_description(self,source,level):
|
||||||
|
"""Reads the data associated with a SOUR description-reference"""
|
||||||
|
note = ""
|
||||||
|
while 1:
|
||||||
|
matches = self.get_next()
|
||||||
|
|
||||||
|
if int(matches[0]) < level:
|
||||||
|
self.backup()
|
||||||
|
return
|
||||||
|
elif matches[1] in ["CONC", "CONT"]: # must be a source description
|
||||||
|
self.backup()
|
||||||
|
comment = self.parse_continue_data(level)
|
||||||
|
source.setComments(comment)
|
||||||
|
comment = "%s\n%s" % (source.getBase().getNote(),comment)
|
||||||
|
source.getBase().setNote(comment)
|
||||||
|
source.getBase().setTitle(self.source_description)
|
||||||
|
elif matches[1] == "NOTE":
|
||||||
|
note = self.parse_comment(matches,source,level+1,note)
|
||||||
|
elif matches[1] == "TEXT":
|
||||||
|
self.ignore_sub_junk(level+1)
|
||||||
|
else:
|
||||||
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_source_data(self,level):
|
def parse_source_data(self,level):
|
||||||
"""Parses the source data"""
|
"""Parses the source data"""
|
||||||
date = ""
|
date = ""
|
||||||
note = ""
|
note = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return (date,note)
|
return (date,note)
|
||||||
elif matches[1] == "DATE":
|
elif matches[1] == "DATE":
|
||||||
@ -1412,17 +1441,17 @@ class GedcomParser:
|
|||||||
elif matches[1] == "TEXT":
|
elif matches[1] == "TEXT":
|
||||||
note = matches[2] + self.parse_continue_data(level+1)
|
note = matches[2] + self.parse_continue_data(level+1)
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_name(self,name,level):
|
def parse_name(self,name,level):
|
||||||
"""Parses the person's name information"""
|
"""Parses the person's name information"""
|
||||||
note = ""
|
note = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] in ["ALIA","_ALIA"]:
|
elif matches[1] in ["ALIA","_ALIA"]:
|
||||||
aka = RelLib.Name()
|
aka = RelLib.Name()
|
||||||
try:
|
try:
|
||||||
names = nameRegexp.match(matches[2]).groups()
|
names = nameRegexp.match(matches[2]).groups()
|
||||||
@ -1436,23 +1465,23 @@ class GedcomParser:
|
|||||||
if names[4]:
|
if names[4]:
|
||||||
aka.setSuffix(names[4])
|
aka.setSuffix(names[4])
|
||||||
self.person.addAlternateName(aka)
|
self.person.addAlternateName(aka)
|
||||||
elif matches[1] == "NPFX":
|
elif matches[1] == "NPFX":
|
||||||
name.setTitle(matches[2])
|
name.setTitle(matches[2])
|
||||||
elif matches[1] == "GIVN":
|
elif matches[1] == "GIVN":
|
||||||
name.setFirstName(matches[2])
|
name.setFirstName(matches[2])
|
||||||
elif matches[1] == "SPFX":
|
elif matches[1] == "SPFX":
|
||||||
name.setSurnamePrefix(matches[2])
|
name.setSurnamePrefix(matches[2])
|
||||||
elif matches[1] == "SURN":
|
elif matches[1] == "SURN":
|
||||||
name.setSurname(matches[2])
|
name.setSurname(matches[2])
|
||||||
self.db.addSurname(matches[2])
|
self.db.addSurname(matches[2])
|
||||||
elif matches[1] == "_MARNM":
|
elif matches[1] == "_MARNM":
|
||||||
self.parse_marnm(self.person,matches[2].strip())
|
self.parse_marnm(self.person,matches[2].strip())
|
||||||
elif matches[1] == "TITL":
|
elif matches[1] == "TITL":
|
||||||
name.setSuffix(matches[2])
|
name.setSuffix(matches[2])
|
||||||
elif matches[1] == "NSFX":
|
elif matches[1] == "NSFX":
|
||||||
if name.getSuffix() == "":
|
if name.getSuffix() == "":
|
||||||
name.setSuffix(matches[2])
|
name.setSuffix(matches[2])
|
||||||
elif matches[1] == "NICK":
|
elif matches[1] == "NICK":
|
||||||
self.person.setNickName(matches[2])
|
self.person.setNickName(matches[2])
|
||||||
elif matches[1] == "_AKA":
|
elif matches[1] == "_AKA":
|
||||||
lname = string.split(matches[2])
|
lname = string.split(matches[2])
|
||||||
@ -1469,11 +1498,12 @@ class GedcomParser:
|
|||||||
source_ref = RelLib.SourceRef()
|
source_ref = RelLib.SourceRef()
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
name.addSourceRef(source_ref)
|
name.addSourceRef(source_ref)
|
||||||
|
self.source_description = matches[2]
|
||||||
self.parse_source_reference(source_ref,level+1)
|
self.parse_source_reference(source_ref,level+1)
|
||||||
elif matches[1][0:4] == "NOTE":
|
elif matches[1][0:4] == "NOTE":
|
||||||
note = self.parse_note(matches,name,level+1,note)
|
note = self.parse_note(matches,name,level+1,note)
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_marnm(self,person,text):
|
def parse_marnm(self,person,text):
|
||||||
data = text.split()
|
data = text.split()
|
||||||
@ -1492,20 +1522,20 @@ class GedcomParser:
|
|||||||
def parse_header_head(self):
|
def parse_header_head(self):
|
||||||
"""validiates that this is a valid GEDCOM file"""
|
"""validiates that this is a valid GEDCOM file"""
|
||||||
line = string.replace(self.f.readline(),'\r','')
|
line = string.replace(self.f.readline(),'\r','')
|
||||||
match = headRE.search(line)
|
match = headRE.search(line)
|
||||||
if not match:
|
if not match:
|
||||||
raise Errors.GedcomError("%s is not a GEDCOM file" % self.filename)
|
raise Errors.GedcomError("%s is not a GEDCOM file" % self.filename)
|
||||||
self.index = self.index + 1
|
self.index = self.index + 1
|
||||||
|
|
||||||
def parse_header_source(self):
|
def parse_header_source(self):
|
||||||
genby = ""
|
genby = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) == 0:
|
if int(matches[0]) == 0:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] == "SOUR":
|
elif matches[1] == "SOUR":
|
||||||
if self.window and self.created_obj.get_text():
|
if self.window and self.created_obj.get_text():
|
||||||
self.update(self.created_obj,matches[2])
|
self.update(self.created_obj,matches[2])
|
||||||
self.gedsource = self.gedmap.get_from_source_tag(matches[2])
|
self.gedsource = self.gedmap.get_from_source_tag(matches[2])
|
||||||
@ -1513,18 +1543,18 @@ class GedcomParser:
|
|||||||
if matches[2] == "FTW":
|
if matches[2] == "FTW":
|
||||||
self.is_ftw = 1
|
self.is_ftw = 1
|
||||||
genby = matches[2]
|
genby = matches[2]
|
||||||
elif matches[1] == "NAME" and self.window:
|
elif matches[1] == "NAME" and self.window:
|
||||||
self.update(self.created_obj,matches[2])
|
self.update(self.created_obj,matches[2])
|
||||||
elif matches[1] == "VERS" and self.window:
|
elif matches[1] == "VERS" and self.window:
|
||||||
self.update(self.version_obj,matches[2])
|
self.update(self.version_obj,matches[2])
|
||||||
pass
|
pass
|
||||||
elif matches[1] in ["CORP","DATA","SUBM","SUBN","COPR","FILE","LANG"]:
|
elif matches[1] in ["CORP","DATA","SUBM","SUBN","COPR","FILE","LANG"]:
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "DEST":
|
elif matches[1] == "DEST":
|
||||||
if genby == "GRAMPS":
|
if genby == "GRAMPS":
|
||||||
self.gedsource = self.gedmap.get_from_source_tag(matches[2])
|
self.gedsource = self.gedmap.get_from_source_tag(matches[2])
|
||||||
self.broken_conc = self.gedsource.get_conc()
|
self.broken_conc = self.gedsource.get_conc()
|
||||||
elif matches[1] == "CHAR":
|
elif matches[1] == "CHAR":
|
||||||
if matches[2] == "UNICODE" or matches[2] == "UTF-8" or matches[2] == "UTF8":
|
if matches[2] == "UNICODE" or matches[2] == "UTF-8" or matches[2] == "UTF8":
|
||||||
self.cnv = nocnv
|
self.cnv = nocnv
|
||||||
elif matches[2] == "ANSEL":
|
elif matches[2] == "ANSEL":
|
||||||
@ -1534,27 +1564,27 @@ class GedcomParser:
|
|||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
if self.window:
|
if self.window:
|
||||||
self.update(self.encoding_obj,matches[2])
|
self.update(self.encoding_obj,matches[2])
|
||||||
elif matches[1] == "GEDC":
|
elif matches[1] == "GEDC":
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "_SCHEMA":
|
elif matches[1] == "_SCHEMA":
|
||||||
self.parse_ftw_schema(2)
|
self.parse_ftw_schema(2)
|
||||||
elif matches[1] == "PLAC":
|
elif matches[1] == "PLAC":
|
||||||
self.parse_place_form(2)
|
self.parse_place_form(2)
|
||||||
elif matches[1] == "DATE":
|
elif matches[1] == "DATE":
|
||||||
date = self.parse_date(2)
|
date = self.parse_date(2)
|
||||||
date.date = matches[2]
|
date.date = matches[2]
|
||||||
elif matches[1] == "NOTE":
|
elif matches[1] == "NOTE":
|
||||||
note = matches[2] + self.parse_continue_data(2)
|
note = matches[2] + self.parse_continue_data(2)
|
||||||
elif matches[1][0] == "_":
|
elif matches[1][0] == "_":
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
self.barf(2)
|
self.barf(2)
|
||||||
|
|
||||||
def parse_ftw_schema(self,level):
|
def parse_ftw_schema(self,level):
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] == "INDI":
|
elif matches[1] == "INDI":
|
||||||
@ -1562,13 +1592,13 @@ class GedcomParser:
|
|||||||
elif matches[1] == "FAM":
|
elif matches[1] == "FAM":
|
||||||
self.parse_ftw_fam_schema(level+1)
|
self.parse_ftw_fam_schema(level+1)
|
||||||
else:
|
else:
|
||||||
self.barf(2)
|
self.barf(2)
|
||||||
|
|
||||||
def parse_ftw_indi_schema(self,level):
|
def parse_ftw_indi_schema(self,level):
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@ -1579,19 +1609,19 @@ class GedcomParser:
|
|||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] == "LABL":
|
elif matches[1] == "LABL":
|
||||||
return matches[2]
|
return matches[2]
|
||||||
else:
|
else:
|
||||||
self.barf(2)
|
self.barf(2)
|
||||||
|
|
||||||
def parse_ftw_fam_schema(self,level):
|
def parse_ftw_fam_schema(self,level):
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
@ -1603,12 +1633,12 @@ class GedcomParser:
|
|||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
|
|
||||||
def ignore_change_data(self,level):
|
def ignore_change_data(self,level):
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if matches[1] == "CHAN":
|
if matches[1] == "CHAN":
|
||||||
self.ignore_sub_junk(level+1)
|
self.ignore_sub_junk(level+1)
|
||||||
else:
|
else:
|
||||||
@ -1618,14 +1648,14 @@ class GedcomParser:
|
|||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] != "FORM":
|
elif matches[1] != "FORM":
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def parse_continue_data(self,level):
|
def parse_continue_data(self,level):
|
||||||
data = ""
|
data = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
@ -1644,7 +1674,7 @@ class GedcomParser:
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def parse_note_continue(self,level):
|
def parse_note_continue(self,level):
|
||||||
data = ""
|
data = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
@ -1669,13 +1699,13 @@ class GedcomParser:
|
|||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return date
|
return date
|
||||||
elif matches[1] == "TIME":
|
elif matches[1] == "TIME":
|
||||||
date.time = matches[2]
|
date.time = matches[2]
|
||||||
else:
|
else:
|
||||||
self.barf(level+1)
|
self.barf(level+1)
|
||||||
|
|
||||||
def extract_date(self,text):
|
def extract_date(self,text):
|
||||||
dateobj = Date.Date()
|
dateobj = Date.Date()
|
||||||
@ -1728,6 +1758,7 @@ class GedcomParser:
|
|||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
else:
|
else:
|
||||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||||
|
self.source_description = matches[2]
|
||||||
self.parse_source_reference(source_ref,level)
|
self.parse_source_reference(source_ref,level)
|
||||||
return source_ref
|
return source_ref
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user