From 2b070e9e5a038d53a50a97fee1d2702c2f518349 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 4 Aug 2006 22:41:51 +0000 Subject: [PATCH] * src/Filters/Rules/Person/_HasFamilyEvent.py (apply): Use new API. * src/Filters/Rules/Person/_PersonWithIncompleteEvent.py (apply): Do not double-handle birth and death events. svn: r7124 --- ChangeLog | 3 +++ src/Filters/Rules/Person/_HasFamilyEvent.py | 8 ++++++-- src/Filters/Rules/Person/_PersonWithIncompleteEvent.py | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93d7072fc..a132be342 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ 2006-08-04 Alex Roitman + * src/Filters/Rules/Person/_HasFamilyEvent.py (apply): Use new API. + * src/Filters/Rules/Person/_PersonWithIncompleteEvent.py + (apply): Do not double-handle birth and death events. * src/Filters/Rules/Person/_IsWitness.py: Rewrite with new API. * src/FilterEditor/_FilterEditor.py (__init__): Remove unneeded argument, namespace is enough to get the filter class via factory; diff --git a/src/Filters/Rules/Person/_HasFamilyEvent.py b/src/Filters/Rules/Person/_HasFamilyEvent.py index b55663d17..de50dcc2e 100644 --- a/src/Filters/Rules/Person/_HasFamilyEvent.py +++ b/src/Filters/Rules/Person/_HasFamilyEvent.py @@ -33,6 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import DateHandler +from RelLib import EventType from Filters.Rules._Rule import Rule from Filters.Rules._RuleUtils import date_cmp @@ -70,8 +71,11 @@ class HasFamilyEvent(Rule): event_handle = event_ref.ref event = db.get_event_from_handle(event_handle) val = 1 - if self.list[0] and event.get_type() != self.list[0]: - val = 0 + if self.list[0]: + specified_type = EventType() + specified_type.set_from_xml_str(self.list[0]) + if event.type != specified_type: + val = 0 v = self.list[3] if v and event.get_description().upper().find(v.upper())==-1: val = 0 diff --git a/src/Filters/Rules/Person/_PersonWithIncompleteEvent.py b/src/Filters/Rules/Person/_PersonWithIncompleteEvent.py index c5c6fa415..46b99651f 100644 --- a/src/Filters/Rules/Person/_PersonWithIncompleteEvent.py +++ b/src/Filters/Rules/Person/_PersonWithIncompleteEvent.py @@ -45,8 +45,7 @@ class PersonWithIncompleteEvent(Rule): category = _('Event filters') def apply(self,db,person): - for event_ref in person.get_event_ref_list() + \ - [person.get_birth_ref(), person.get_death_ref()]: + for event_ref in person.get_event_ref_list(): if event_ref: event = db.get_event_from_handle(event_ref.ref) if not event.get_place_handle():