* src/GenericFilter.py: Proper test for place in event-based filters.

svn: r4922
This commit is contained in:
Alex Roitman 2005-07-13 15:13:09 +00:00
parent 1b18e85c18
commit 996bc358ae
2 changed files with 34 additions and 19 deletions

View File

@ -1,3 +1,6 @@
2005-07-13 Alex Roitman <shura@gramps-project.org>
* src/GenericFilter.py: Proper test for place in event-based filters.
2005-07-13 Don Allingham <don@gramps-project.org>
* src/GrampsInMemDB.py: add get_event_cursor
* src/GrampsDbBase.py: add get_event_cursor

View File

@ -999,7 +999,7 @@ class HasEvent(Rule):
description = _("Matches people with a personal event of a particular value")
category = _('Event filters')
def prepare(self,list):
def prepare(self,db):
self.date = None
try:
if self.list and self.list[1]:
@ -1048,7 +1048,7 @@ class HasFamilyEvent(Rule):
description = _("Matches people with a family event of a particular value")
category = _('Event filters')
def prepare(self,list):
def prepare(self,db):
self.date = None
try:
if self.list and self.list[1]:
@ -1071,12 +1071,16 @@ class HasFamilyEvent(Rule):
if self.date:
if date_cmp(self.date,event.get_date_object()):
val = 0
if self.list[2]:
pl_id = event.get_place_handle()
if pl_id:
pl = db.get_place_from_handle(pl_id)
pn = pl.get_title()
if self.list[2] and pn.find(self.list[2].upper()) == -1:
pn = pl.get_title().upper()
if pn.find(self.list[2].upper()) == -1:
val = 0
else:
val = 0
if val == 1:
return True
return False
@ -1158,16 +1162,20 @@ class HasBirth(Rule):
return False
event = db.get_event_from_handle(event_handle)
ed = event.get_description().upper()
if len(self.list) > 2 and ed.find(self.list[2].upper())==-1:
if len(self.list) > 2 and self.list[2] \
and ed.find(self.list[2].upper())==-1:
return False
if self.date:
if date_cmp(self.date,event.get_date_object()) == 0:
return False
if len(self.list)>1 and self.list[1]:
pl_id = event.get_place_handle()
if pl_id:
pl = db.get_place_from_handle(pl_id)
pn = pl.get_title()
if len(self.list) > 1 and pn.find(self.list[1].upper()) == -1:
pn = pl.get_title().upper
if pn.find(self.list[1].upper()) == -1:
return False
else:
return False
return True
@ -1197,17 +1205,21 @@ class HasDeath(Rule):
return False
event = db.get_event_from_handle(event_handle)
ed = event.get_description().upper()
if self.list[2] and ed.find(self.list[2].upper())==-1:
if len(self.list)>2 and self.list[2] \
and ed.find(self.list[2].upper())==-1:
return False
if self.date:
if date_cmp(self.date,event.get_date_object()) == 0:
return False
if len(self.list)>1 and self.list[1]:
pl_id = event.get_place_handle()
if pl_id:
pl = db.get_place_from_handle(pl_id)
pn = pl.get_title()
pn = pl.get_title().upper()
if self.list[1] and pn.find(self.list[1].upper()) == -1:
return False
else:
return False
return True
#-------------------------------------------------------------------------