break links

svn: r868
This commit is contained in:
Don Allingham 2002-03-28 15:02:14 +00:00
parent 9a49e7da17
commit 5b7e45232e

View File

@ -138,6 +138,7 @@ class GedcomParser:
self.fmap = {} self.fmap = {}
self.smap = {} self.smap = {}
self.nmap = {} self.nmap = {}
self.share_note = []
self.refn = {} self.refn = {}
self.added = {} self.added = {}
self.gedmap = GedcomInfoDB() self.gedmap = GedcomInfoDB()
@ -264,7 +265,12 @@ class GedcomParser:
self.parse_trailer() self.parse_trailer()
self.update(self.families_obj,str(self.fam_count)) self.update(self.families_obj,str(self.fam_count))
self.update(self.people_obj,str(self.indi_count)) self.update(self.people_obj,str(self.indi_count))
self.break_note_links()
def break_note_links(self):
for o in self.share_note:
o.unique_note()
def parse_trailer(self): def parse_trailer(self):
matches = self.get_next() matches = self.get_next()
@ -323,9 +329,11 @@ class GedcomParser:
else: else:
if self.nmap.has_key(matches[2]): if self.nmap.has_key(matches[2]):
self.source.setNoteObj(self.nmap[matches[2]]) self.source.setNoteObj(self.nmap[matches[2]])
self.share_note.append(self.source)
else: else:
noteobj = Note() noteobj = Note()
self.nmap[matches[2]] = noteobj self.nmap[matches[2]] = noteobj
self.share_note.append(self.source)
self.source.setNoteObj(noteobj) self.source.setNoteObj(noteobj)
elif matches[1] == "TEXT": elif matches[1] == "TEXT":
d = self.parse_continue_data(level+1) d = self.parse_continue_data(level+1)
@ -521,10 +529,12 @@ class GedcomParser:
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
else: else:
if self.nmap.has_key(matches[2]): if self.nmap.has_key(matches[2]):
self.share_note(self.family)
self.family.setNoteObj(self.nmap[matches[2]]) self.family.setNoteObj(self.nmap[matches[2]])
else: else:
noteobj = Note() noteobj = Note()
self.nmap[matches[2]] = noteobj self.nmap[matches[2]] = noteobj
self.share_note(self.family)
self.family.setNoteObj(noteobj) self.family.setNoteObj(noteobj)
else: else:
event = Event() event = Event()
@ -595,9 +605,11 @@ class GedcomParser:
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
else: else:
if self.nmap.has_key(matches[2]): if self.nmap.has_key(matches[2]):
self.share_note(self.person)
self.person.setNoteObj(self.nmap[matches[2]]) self.person.setNoteObj(self.nmap[matches[2]])
else: else:
noteobj = Note() noteobj = Note()
self.share_note(self.person)
self.nmap[matches[2]] = noteobj self.nmap[matches[2]] = noteobj
self.person.setNoteObj(noteobj) self.person.setNoteObj(noteobj)
elif matches[1] == "SEX": elif matches[1] == "SEX":
@ -912,10 +924,12 @@ class GedcomParser:
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
else: else:
if self.nmap.has_key(matches[2]): if self.nmap.has_key(matches[2]):
self.share_note(address)
address.setNoteObj(self.nmap[matches[2]]) address.setNoteObj(self.nmap[matches[2]])
else: else:
noteobj = Note() noteobj = Note()
self.nmap[matches[2]] = noteobj self.nmap[matches[2]] = noteobj
self.share_note(address)
address.setNoteObj(noteobj) address.setNoteObj(noteobj)
else: else:
self.barf(level+1) self.barf(level+1)
@ -990,10 +1004,12 @@ class GedcomParser:
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
else: else:
if self.nmap.has_key(matches[2]): if self.nmap.has_key(matches[2]):
self.share_note(ord)
ord.setNoteObj(self.nmap[matches[2]]) ord.setNoteObj(self.nmap[matches[2]])
else: else:
noteobj = Note() noteobj = Note()
self.nmap[matches[2]] = noteobj self.nmap[matches[2]] = noteobj
self.share_note(ord)
ord.setNoteObj(noteobj) ord.setNoteObj(noteobj)
elif matches[1] == "STAT": elif matches[1] == "STAT":
if const.lds_status.has_key(matches[2]): if const.lds_status.has_key(matches[2]):
@ -1275,10 +1291,12 @@ class GedcomParser:
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
else: else:
if self.nmap.has_key(matches[2]): if self.nmap.has_key(matches[2]):
self.share_note(event)
event.setNoteObj(self.nmap[matches[2]]) event.setNoteObj(self.nmap[matches[2]])
else: else:
noteobj = Note() noteobj = Note()
self.nmap[matches[2]] = noteobj self.nmap[matches[2]] = noteobj
self.share_note(event)
event.setNoteObj(noteobj) event.setNoteObj(noteobj)
else: else:
self.barf(level+1) self.barf(level+1)
@ -1314,10 +1332,12 @@ class GedcomParser:
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
else: else:
if self.nmap.has_key(matches[2]): if self.nmap.has_key(matches[2]):
self.share_note(source)
source.setNoteObj(self.nmap[matches[2]]) source.setNoteObj(self.nmap[matches[2]])
else: else:
noteobj = Note() noteobj = Note()
self.nmap[matches[2]] = noteobj self.nmap[matches[2]] = noteobj
self.share_note(source)
source.setNoteObj(noteobj) source.setNoteObj(noteobj)
else: else:
self.barf(level+1) self.barf(level+1)
@ -1398,10 +1418,12 @@ class GedcomParser:
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
else: else:
if self.nmap.has_key(matches[2]): if self.nmap.has_key(matches[2]):
self.share_note(name)
name.setNoteObj(self.nmap[matches[2]]) name.setNoteObj(self.nmap[matches[2]])
else: else:
noteobj = Note() noteobj = Note()
self.nmap[matches[2]] = noteobj self.nmap[matches[2]] = noteobj
self.share_note(name)
name.setNoteObj(noteobj) name.setNoteObj(noteobj)
else: else:
self.barf(level+1) self.barf(level+1)