svn: r8819

This commit is contained in:
Don Allingham 2007-08-15 04:14:19 +00:00
parent 3a4ba79b64
commit 2a3897c685

View File

@ -682,7 +682,7 @@ class GedcomWriter(UpdateCallback):
def __write_remaining_events(self, person): def __write_remaining_events(self, person):
ad = 0 ad = False
for event_ref in person.get_event_ref_list(): for event_ref in person.get_event_ref_list():
event = self.db.get_event_from_handle(event_ref.ref) event = self.db.get_event_from_handle(event_ref.ref)
etype = int(event.get_type()) etype = int(event.get_type())
@ -693,10 +693,7 @@ class GedcomWriter(UpdateCallback):
val = GedcomInfo.personalConstantEvents.get( val = GedcomInfo.personalConstantEvents.get(
etype, self.target_ged.gramps2tag(etype)) etype, self.target_ged.gramps2tag(etype))
if self.adopt == GedcomInfo.ADOPT_EVENT and val == "ADOP": if val and val.strip():
ad = 1
self.__write_adoption_record(person)
elif val and val.strip():
if val in personalAttributeTakesParam: if val in personalAttributeTakesParam:
if event.get_description().strip(): if event.get_description().strip():
self.__writeln(1, val, event.get_description()) self.__writeln(1, val, event.get_description())
@ -726,25 +723,22 @@ class GedcomWriter(UpdateCallback):
self.dump_event_stats(event, event_ref) self.dump_event_stats(event, event_ref)
if (self.adopt == GedcomInfo.ADOPT_EVENT) and (ad == 0) \ self.__write_adoption_record(person)
and (len(person.get_parent_family_handle_list()) != 0):
self.__write_adoption_record(person)
def __write_adoption_record(self, person): def __write_adoption_record(self, person):
self.__writeln(1, 'ADOP')
fam = None adopt_records = []
for fh in person.get_parent_family_handle_list():
family = self.db.get_family_from_handle(fh) for family in [ self.db.get_family_from_handle(fh)
for fh in person.get_parent_family_handle_list() ]:
for child_ref in family.get_child_ref_list(): for child_ref in family.get_child_ref_list():
if child_ref.ref == person.handle: if child_ref.ref == person.handle:
if child_ref.mrel == RelLib.ChildRefType.ADOPTED \ if child_ref.mrel == RelLib.ChildRefType.ADOPTED \
or child_ref.frel == RelLib.ChildRefType.ADOPTED: or child_ref.frel == RelLib.ChildRefType.ADOPTED:
frel = child_ref.frel adopt_records.append((family, child_ref.frel, child_ref.mrel))
mrel = child_ref.mrel
fam = family for (fam, frel, mrel) in adopt_records:
break self.__writeln(1, 'ADOP', 'Y')
if fam:
self.__writeln(2, 'FAMC', '@%s@' % fam.get_gramps_id()) self.__writeln(2, 'FAMC', '@%s@' % fam.get_gramps_id())
if mrel == frel: if mrel == frel:
self.__writeln(3, 'ADOP', 'BOTH') self.__writeln(3, 'ADOP', 'BOTH')