From 355c3865f592ec66b76635f56468424aa9c20b98 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sun, 22 Aug 2004 05:33:37 +0000 Subject: [PATCH] * src/WriteGedcom.py (write_sources, write_person, write_ord): Use gramps id instead of handle. * src/GenericFilter.py: Check object for being not None. svn: r3467 --- gramps2/ChangeLog | 4 ++++ gramps2/src/GenericFilter.py | 20 ++++++++++---------- gramps2/src/WriteGedcom.py | 8 ++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 085a14baa..a08884eab 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -37,6 +37,10 @@ * src/plugins/Check.py: Import const module. * src/PedView.py: Add person to the list even if there are no parents. + * src/WriteGedcom.py (write_sources, write_person, write_ord): + Use gramps id instead of handle. + * src/GenericFilter.py: Check object for being not None. + 2004-08-20 Don Allingham * src/gramps_main.py: update family display after EditPerson * src/EditPerson.py: fix callback diff --git a/gramps2/src/GenericFilter.py b/gramps2/src/GenericFilter.py index 8760a703e..9b779c011 100644 --- a/gramps2/src/GenericFilter.py +++ b/gramps2/src/GenericFilter.py @@ -169,8 +169,8 @@ class RelationshipPathBetween(Rule): p = self.db.get_person_from_handle(p_id) for fam_id in p.get_family_handle_list(): - if fam_id: - fam = self.db.get_family_from_handle(fam_id) + fam = self.db.get_family_from_handle(fam_id) + if fam: for child_handle in fam.get_child_handle_list(): if child_handle: self.desc_list(child_handle,map,0) @@ -351,8 +351,8 @@ class IsDescendantOf(Rule): p = self.db.get_person_from_handle(p_id) for fam_id in p.get_family_handle_list(): - if fam_id: - fam = self.db.get_family_from_handle(fam_id) + fam = self.db.get_family_from_handle(fam_id) + if fam: for child_handle in fam.get_child_handle_list(): self.init_list(child_handle,0) @@ -635,8 +635,8 @@ class IsAncestorOf(Rule): p = self.db.get_person_from_handle(p_id) fam_id = p.get_main_parents_family_handle() - if fam_id: - fam = self.db.get_family_from_handle(fam_id) + fam = self.db.get_family_from_handle(fam_id) + if fam: f_id = fam.get_father_handle() m_id = fam.get_mother_handle() @@ -732,8 +732,8 @@ class IsLessThanNthGenerationAncestorOf(Rule): p = self.db.get_person_from_handle(p_id) fam_id = p.get_main_parents_family_handle() - if fam_id: - fam = self.db.get_family_from_handle(fam_id) + fam = self.db.get_family_from_handle(fam_id) + if fam: f_id = fam.get_father_handle() m_id = fam.get_mother_handle() @@ -785,8 +785,8 @@ class IsMoreThanNthGenerationAncestorOf(Rule): p = self.db.get_person_from_handle(p_id) fam_id = p.get_main_parents_family_handle() - if fam_id: - fam = self.db.get_family_from_handle(fam_id) + fam = self.db.get_family_from_handle(fam_id) + if fam: f_id = fam.get_father_handle() m_id = fam.get_mother_handle() diff --git a/gramps2/src/WriteGedcom.py b/gramps2/src/WriteGedcom.py index 9e8282122..bfbdd77ad 100644 --- a/gramps2/src/WriteGedcom.py +++ b/gramps2/src/WriteGedcom.py @@ -817,7 +817,7 @@ class GedcomWriter: index = 0.0 for key in self.slist.keys(): source = self.db.get_source_from_handle(key) - self.writeln("0 @%s@ SOUR" % self.sid(source.get_handle())) + self.writeln("0 @%s@ SOUR" % self.sid(source.get_gramps_id())) if source.get_title(): self.writeln("1 TITL %s" % fmtline(self.cnvtxt(source.get_title()),248,1,self.nl)) if source.get_author(): @@ -912,7 +912,7 @@ class GedcomWriter: fam = f[0] break if fam: - self.writeln('2 FAMC @%s@' % self.fid(fam.get_handle())) + self.writeln('2 FAMC @%s@' % self.fid(fam.get_gramps_id())) if mrel == frel: self.writeln('3 ADOP BOTH') elif mrel == "adopted": @@ -938,7 +938,7 @@ class GedcomWriter: fam = f[0] break if fam: - self.writeln('2 FAMC @%s@' % self.fid(fam.get_handle())) + self.writeln('2 FAMC @%s@' % self.fid(fam.get_gramps_id())) if mrel == frel: self.writeln('3 ADOP BOTH') elif mrel == "adopted": @@ -1137,7 +1137,7 @@ class GedcomWriter: self.writeln('%d %s' % (index,name)) self.print_date("%d DATE" % (index + 1), ord.get_date_object()) if ord.get_family_handle(): - self.writeln('%d FAMC @%s@' % (index+1,self.fid(ord.get_family_handle().get_handle()))) + self.writeln('%d FAMC @%s@' % (index+1,self.fid(ord.get_family_handle().get_gramps_id()))) if ord.get_temple(): self.writeln('%d TEMP %s' % (index+1,ord.get_temple())) if ord.get_place_handle():