* src/Filters/Rules/Person/_HasRelationship.py: Fix FamilyRelType comparison (closes #758)

svn: r7794
This commit is contained in:
Martin Hawlisch 2006-12-13 09:21:53 +00:00
parent c99d5ca6e7
commit f2eb4451b6
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2006-12-13 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/Filters/Rules/Person/_HasRelationship.py: Fix FamilyRelType
comparison (closes #758)
2006-12-12 Alex Roitman <shura@gramps-project.org> 2006-12-12 Alex Roitman <shura@gramps-project.org>
* src/ViewManager.py (about): Only displaye translator credits * src/ViewManager.py (about): Only displaye translator credits
when they exist. when they exist.

View File

@ -33,6 +33,7 @@ from gettext import gettext as _
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Filters.Rules._Rule import Rule from Filters.Rules._Rule import Rule
from RelLib import FamilyRelType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -53,12 +54,15 @@ class HasRelationship(Rule):
rel_type = 0 rel_type = 0
cnt = 0 cnt = 0
num_rel = len(person.get_family_handle_list()) num_rel = len(person.get_family_handle_list())
if self.list[1]:
specified_type = FamilyRelType()
specified_type.set_from_xml_str(self.list[1])
# count children and look for a relationship type match # count children and look for a relationship type match
for f_id in person.get_family_handle_list(): for f_id in person.get_family_handle_list():
f = db.get_family_from_handle(f_id) f = db.get_family_from_handle(f_id)
cnt = cnt + len(f.get_child_ref_list()) cnt = cnt + len(f.get_child_ref_list())
if self.list[1] and int(self.list[1]) == f.get_relationship(): if self.list[1] and specified_type == f.get_relationship():
rel_type = 1 rel_type = 1
# if number of relations specified # if number of relations specified