0002953: wrong handling of gramps id's on individual report. I44 and I440 I441 etc are all included when only I44 should be

replacing comparison by find with ==    (find only looks for substrings, doesn't check for equality of strings)

svn: r15023
This commit is contained in:
Raphael Ackermann 2010-04-04 11:07:29 +00:00
parent 08728c6bd4
commit 10206b34a0

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Raphael Ackermann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -40,7 +41,7 @@ from Filters.Rules import Rule
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class HasGrampsId(Rule): class HasGrampsId(Rule):
"""Rule that checks for a person with a specific GRAMPS ID.""" """Rule that checks for an object with a specific GRAMPS ID."""
labels = [ _('ID:') ] labels = [ _('ID:') ]
name = _('Object with <Id>') name = _('Object with <Id>')
@ -48,4 +49,8 @@ class HasGrampsId(Rule):
category = _('General filters') category = _('General filters')
def apply(self, db, obj): def apply(self, db, obj):
return obj.gramps_id.find(self.list[0]) !=-1 """
apply the rule on the obj.
return true if the rule passes, false otherwise.
"""
return obj.gramps_id == self.list[0]