* src/plugins/ReadGedcom.py: Revert brain-dead fix in favor of

an existing handle_source() method.


svn: r2587
This commit is contained in:
Alex Roitman 2004-01-05 06:03:28 +00:00
parent 2a92fac355
commit 7bb94c7b3a
2 changed files with 7 additions and 39 deletions

View File

@ -2,6 +2,9 @@
* src/plugins/ReadGedcom.py: Correct level in parsing LDS ordinance * src/plugins/ReadGedcom.py: Correct level in parsing LDS ordinance
source references. Support for source description-type references. source references. Support for source description-type references.
* src/plugins/ReadGedcom.py: Revert brain-dead fix in favor of
an existing handle_source() method.
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).

View File

@ -1054,11 +1054,7 @@ class GedcomParser:
elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE","_DATE2"]: elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE","_DATE2"]:
self.ignore_sub_junk(level+1) self.ignore_sub_junk(level+1)
elif matches[1] == "SOUR": elif matches[1] == "SOUR":
source_ref = RelLib.SourceRef() address.addSourceRef(self.handle_source(matches,level+1))
source_ref.setBase(self.db.findSource(matches[2],self.smap))
address.addSourceRef(source_ref)
self.source_description = matches[2]
self.parse_source_reference(source_ref,level+1)
elif matches[1] == "PLAC": elif matches[1] == "PLAC":
address.setStreet(matches[2]) address.setStreet(matches[2])
self.parse_address(address,level+1) self.parse_address(address,level+1)
@ -1379,10 +1375,6 @@ class GedcomParser:
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":
@ -1404,29 +1396,6 @@ class GedcomParser:
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 = ""
@ -1495,11 +1464,7 @@ class GedcomParser:
name.setFirstName(string.join(lname[0:l-1])) name.setFirstName(string.join(lname[0:l-1]))
self.person.addAlternateName(name) self.person.addAlternateName(name)
elif matches[1] == "SOUR": elif matches[1] == "SOUR":
source_ref = RelLib.SourceRef() name.addSourceRef(self.handle_source(matches,level+1))
source_ref.setBase(self.db.findSource(matches[2],self.smap))
name.addSourceRef(source_ref)
self.source_description = matches[2]
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:
@ -1753,9 +1718,9 @@ class GedcomParser:
s = self.db.findSource(ref,self.smap) s = self.db.findSource(ref,self.smap)
source_ref.setBase(s) source_ref.setBase(s)
s.setTitle('Imported Source #%d' % self.localref) s.setTitle('Imported Source #%d' % self.localref)
s.setNote(matches[2] + self.parse_continue_data(1)) s.setNote(matches[2] + self.parse_continue_data(level))
self.db.buildSourceDisplay(s.getId()) self.db.buildSourceDisplay(s.getId())
self.ignore_sub_junk(2) self.ignore_sub_junk(level+1)
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.source_description = matches[2]