diff --git a/src/Filters/Rules/_Rule.py b/src/Filters/Rules/_Rule.py index 9f0c0be3a..f09bcc981 100644 --- a/src/Filters/Rules/_Rule.py +++ b/src/Filters/Rules/_Rule.py @@ -69,9 +69,12 @@ class Rule(object): def apply(self, db, person): return True + #def __nonzero__(self, db, person): + # return self.apply(db, person) + def display_values(self): - v = [ '%s="%s"' % (_(self.labels[ix]),_(self.list[ix])) - for ix in range(0,len(self.list)) if self.list[ix] ] + v = ( '%s="%s"' % ((_(self.labels[ix]),)*2) + for ix in xrange(len(self.list)) if self.list[ix] ) return ';'.join(v) diff --git a/src/Filters/_GenericFilter.py b/src/Filters/_GenericFilter.py index b045ce46c..84388e588 100644 --- a/src/Filters/_GenericFilter.py +++ b/src/Filters/_GenericFilter.py @@ -184,13 +184,13 @@ class GenericFilter(object): return test def one_test(self, db, person): - count = 0 + found_one = False for rule in self.flist: if rule.apply(db, person): - if count: - return False - count += 1 - return count == 1 + if found_one: + return False # There can be only one! + found_one = True + return found_one def or_test(self, db, person): return any(rule.apply(db, person) for rule in self.flist) diff --git a/src/gen/db/base.py b/src/gen/db/base.py index 1c89e032c..7d30c602b 100644 --- a/src/gen/db/base.py +++ b/src/gen/db/base.py @@ -1374,8 +1374,8 @@ class GrampsDbBase(Callback): Return an iterator over handles for Persons in the database """ with self.get_person_cursor() as cursor: - for data in cursor: - yield data[0] + for key, data in cursor: + yield key def get_place_handles(self, sort_handles=True): """ @@ -1398,8 +1398,8 @@ class GrampsDbBase(Callback): Return an iterator over handles for Places in the database """ with self.get_place_cursor() as cursor: - for data in cursor: - yield data[0] + for key, data in cursor: + yield key def get_source_handles(self, sort_handles=True): """ @@ -1420,8 +1420,8 @@ class GrampsDbBase(Callback): Return an iterator over handles for Sources in the database """ with self.get_source_cursor() as cursor: - for data in cursor: - yield data[0] + for key, data in cursor: + yield key def get_media_object_handles(self, sort_handles=True): """ @@ -1442,8 +1442,8 @@ class GrampsDbBase(Callback): Return an iterator over handles for Media in the database """ with self.get_media_cursor() as cursor: - for data in cursor: - yield data[0] + for key, data in cursor: + yield key def get_event_handles(self): """ @@ -1459,8 +1459,8 @@ class GrampsDbBase(Callback): Return an iterator over handles for Events in the database """ with self.get_event_cursor() as cursor: - for data in cursor: - yield data[0] + for key, data in cursor: + yield key def get_family_handles(self): """ @@ -1476,8 +1476,8 @@ class GrampsDbBase(Callback): Return an iterator over handles for Families in the database """ with self.get_family_cursor() as cursor: - for data in cursor: - yield data[0] + for key, data in cursor: + yield key def get_repository_handles(self): """ @@ -1493,8 +1493,8 @@ class GrampsDbBase(Callback): Return an iterator over handles for Repositories in the database """ with self.get_repository_cursor() as cursor: - for data in cursor: - yield data[0] + for key, data in cursor: + yield key def get_note_handles(self): """ @@ -1510,8 +1510,8 @@ class GrampsDbBase(Callback): Return an iterator over handles for Notes in the database """ with self.get_note_cursor() as cursor: - for data in cursor: - yield data[0] + for key, data in cursor: + yield key def get_gramps_ids(self, obj_key): key2table = {