svn: r12775
This commit is contained in:
Gerald Britton 2009-07-08 16:10:13 +00:00
parent 2769b58a44
commit f680992d04
3 changed files with 26 additions and 23 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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 = {