From a5a349219a8f7740aeff5a1e8bc76efcd41b2098 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 15 Jan 2008 19:04:46 +0000 Subject: [PATCH] 2008-01-15 Douglas S. Blank * src/plugins/SameSurnames.py (IncompleteSurname.apply): can bring up people with empty surname * src/plugins/ImportCSV.py (CSVParser.process): fixed csv import with no surname (bug #1603) svn: r9826 --- ChangeLog | 8 ++++++-- src/plugins/SameSurnames.py | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index adde4db45..c81408b81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,14 @@ +2008-01-15 Douglas S. Blank + * src/plugins/SameSurnames.py (IncompleteSurname.apply): + can bring up people with empty surname + 2008-01-15 Raphael Ackermann * src/FilterEditor/_ShowResults.py: allow notes to be filtered 0001607: Unreferenced filter test 2008-01-15 Douglas S. Blank - * src/plugins/ImportCSV.py (CSVParser.process): fixed csv import with no - surname (bug #1603) + * src/plugins/ImportCSV.py (CSVParser.process): fixed csv import with + no surname (bug #1603) 2008-01-15 Douglas S. Blank * src/plugins/DefaultGramplets.py (TopSurnamesGramplet.main): make diff --git a/src/plugins/SameSurnames.py b/src/plugins/SameSurnames.py index 839ecd655..43cd5221c 100644 --- a/src/plugins/SameSurnames.py +++ b/src/plugins/SameSurnames.py @@ -27,9 +27,21 @@ from Simple import SimpleAccess, SimpleDoc, SimpleTable from gettext import gettext as _ from PluginUtils import register_quick_report from ReportBase import CATEGORY_QR_PERSON +from Filters.Rules import Rule from Filters.Rules.Person import SearchName from Filters import GenericFilterFactory, Rules +class IncompleteSurname(Rule): + """People with incomplete surnames""" + name = _('People with incomplete surnames') + description = _("Matches people with lastname missing") + category = _('General filters') + def apply(self,db,person): + for name in [person.get_primary_name()] + person.get_alternate_names(): + if name.get_surname() == "": + return True + return False + def run(database, document, person): """ Loops through the families that the person is a child in, and display @@ -46,7 +58,10 @@ def run(database, document, person): # grab our current id (self): gid = sdb.gid(person) filter = GenericFilterFactory('Person')() - rule = SearchName([person.get_primary_name().get_surname()]) + if person.get_primary_name().get_surname() != '': + rule = SearchName([person.get_primary_name().get_surname()]) + else: + rule = IncompleteSurname([]) filter.add_rule(rule) people = filter.apply(database, database.get_person_handles(sort_handles=False))