From a0429eabd39e9f47b133b5e85bad1317059777d4 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Fri, 1 Apr 2005 07:39:21 +0000 Subject: [PATCH] * src/plugins/Check.py: new database callback scheme; Use Utils.family_name. * src/plugins/ChangeNames.py: new database callback scheme * src/plugins/TestcaseGenerator.py: new database callback scheme svn: r4268 --- ChangeLog | 5 +++++ src/plugins/ChangeNames.py | 1 + src/plugins/Check.py | 32 +++++--------------------------- src/plugins/TestcaseGenerator.py | 3 ++- 4 files changed, 13 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a1da06a5..203eb3b27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-04-01 Martin Hawlisch + * src/plugins/Check.py: new database callback scheme; Use Utils.family_name. + * src/plugins/ChangeNames.py: new database callback scheme + * src/plugins/TestcaseGenerator.py: new database callback scheme + 2005-03-31 Don Allingham * src/AddSpouse.py: new database callback scheme. This scheme provides a registration mechanism to signal interested objects diff --git a/src/plugins/ChangeNames.py b/src/plugins/ChangeNames.py index 85940f6aa..e53f40256 100644 --- a/src/plugins/ChangeNames.py +++ b/src/plugins/ChangeNames.py @@ -79,6 +79,7 @@ class ChangeNames: return self.win_key = self.__class__ self.trans = db.transaction_begin() + self.trans.set_batch(True) self.name_list = [] for name in self.db.get_surname_list(): diff --git a/src/plugins/Check.py b/src/plugins/Check.py index fa4b0d4d0..9bd66ecfd 100644 --- a/src/plugins/Check.py +++ b/src/plugins/Check.py @@ -58,6 +58,7 @@ def runTool(database,active_person,callback,parent=None): try: trans = database.transaction_begin() + self.trans.set_batch(True) checker = CheckIntegrity(database,parent,trans) checker.check_for_broken_family_links() checker.cleanup_missing_photos(0) @@ -356,25 +357,12 @@ class CheckIntegrity: self.text.write(_("%d broken child/family links were found\n") % blink) for (person_handle,family_handle) in self.broken_links: person = self.db.get_person_from_handle(person_handle) - family = self.db.get_family_from_handle(family_handle) if person: cn = person.get_primary_name().get_name() else: cn = _("Non existing child") - if family: - f = self.db.get_person_from_handle(family.get_father_handle()) - m = self.db.get_person_from_handle(family.get_mother_handle()) - if f and m: - pn = _("%s and %s") % (f.get_primary_name().get_name(),\ - m.get_primary_name().get_name()) - elif f: - pn = f.get_primary_name().get_name() - elif m: - pn = m.get_primary_name().get_name() - else: - pn = _("unknown") - else: - pn = _("Non existing family") + family = self.db.get_family_from_handle(family_handle) + pn = Utils.family_name(family,self.db) self.text.write('\t') self.text.write(_("%s was removed from the family of %s\n") % (cn,pn)) @@ -385,22 +373,12 @@ class CheckIntegrity: self.text.write(_("%d broken spouse/family links were found\n") % plink) for (person_handle,family_handle) in self.broken_parent_links: person = self.db.get_person_from_handle(person_handle) - family = self.db.get_family_from_handle(family_handle) if person: cn = person.get_primary_name().get_name() else: cn = _("Non existing person") - f = self.db.get_person_from_handle(family.get_father_handle()) - m = self.db.get_person_from_handle(family.get_mother_handle()) - if f and m: - pn = _("%s and %s") % (f.get_primary_name().get_name(),\ - m.get_primary_name().get_name()) - elif f: - pn = f.get_primary_name().get_name() - elif m: - pn = m.get_primary_name().get_name() - else: - pn = "Non existing person" + family = self.db.get_family_from_handle(family_handle) + pn = Utils.family_name(family,self.db) self.text.write('\t') self.text.write(_("%s was restored to the family of %s\n") % (cn,pn)) diff --git a/src/plugins/TestcaseGenerator.py b/src/plugins/TestcaseGenerator.py index 5ebc4ee6c..59519f7e3 100644 --- a/src/plugins/TestcaseGenerator.py +++ b/src/plugins/TestcaseGenerator.py @@ -124,7 +124,8 @@ class TestcaseGenerator: self.max_person_count = generate_max_persons self.trans = self.db.transaction_begin() - + self.trans.set_batch(True) + if generate_bugs: self.generate_broken_relations()