Tweaks
svn: r12775
This commit is contained in:
parent
2769b58a44
commit
f680992d04
@ -69,9 +69,12 @@ class Rule(object):
|
|||||||
def apply(self, db, person):
|
def apply(self, db, person):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
#def __nonzero__(self, db, person):
|
||||||
|
# return self.apply(db, person)
|
||||||
|
|
||||||
def display_values(self):
|
def display_values(self):
|
||||||
v = [ '%s="%s"' % (_(self.labels[ix]),_(self.list[ix]))
|
v = ( '%s="%s"' % ((_(self.labels[ix]),)*2)
|
||||||
for ix in range(0,len(self.list)) if self.list[ix] ]
|
for ix in xrange(len(self.list)) if self.list[ix] )
|
||||||
|
|
||||||
return ';'.join(v)
|
return ';'.join(v)
|
||||||
|
|
||||||
|
@ -184,13 +184,13 @@ class GenericFilter(object):
|
|||||||
return test
|
return test
|
||||||
|
|
||||||
def one_test(self, db, person):
|
def one_test(self, db, person):
|
||||||
count = 0
|
found_one = False
|
||||||
for rule in self.flist:
|
for rule in self.flist:
|
||||||
if rule.apply(db, person):
|
if rule.apply(db, person):
|
||||||
if count:
|
if found_one:
|
||||||
return False
|
return False # There can be only one!
|
||||||
count += 1
|
found_one = True
|
||||||
return count == 1
|
return found_one
|
||||||
|
|
||||||
def or_test(self, db, person):
|
def or_test(self, db, person):
|
||||||
return any(rule.apply(db, person) for rule in self.flist)
|
return any(rule.apply(db, person) for rule in self.flist)
|
||||||
|
@ -1374,8 +1374,8 @@ class GrampsDbBase(Callback):
|
|||||||
Return an iterator over handles for Persons in the database
|
Return an iterator over handles for Persons in the database
|
||||||
"""
|
"""
|
||||||
with self.get_person_cursor() as cursor:
|
with self.get_person_cursor() as cursor:
|
||||||
for data in cursor:
|
for key, data in cursor:
|
||||||
yield data[0]
|
yield key
|
||||||
|
|
||||||
def get_place_handles(self, sort_handles=True):
|
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
|
Return an iterator over handles for Places in the database
|
||||||
"""
|
"""
|
||||||
with self.get_place_cursor() as cursor:
|
with self.get_place_cursor() as cursor:
|
||||||
for data in cursor:
|
for key, data in cursor:
|
||||||
yield data[0]
|
yield key
|
||||||
|
|
||||||
def get_source_handles(self, sort_handles=True):
|
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
|
Return an iterator over handles for Sources in the database
|
||||||
"""
|
"""
|
||||||
with self.get_source_cursor() as cursor:
|
with self.get_source_cursor() as cursor:
|
||||||
for data in cursor:
|
for key, data in cursor:
|
||||||
yield data[0]
|
yield key
|
||||||
|
|
||||||
def get_media_object_handles(self, sort_handles=True):
|
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
|
Return an iterator over handles for Media in the database
|
||||||
"""
|
"""
|
||||||
with self.get_media_cursor() as cursor:
|
with self.get_media_cursor() as cursor:
|
||||||
for data in cursor:
|
for key, data in cursor:
|
||||||
yield data[0]
|
yield key
|
||||||
|
|
||||||
def get_event_handles(self):
|
def get_event_handles(self):
|
||||||
"""
|
"""
|
||||||
@ -1459,8 +1459,8 @@ class GrampsDbBase(Callback):
|
|||||||
Return an iterator over handles for Events in the database
|
Return an iterator over handles for Events in the database
|
||||||
"""
|
"""
|
||||||
with self.get_event_cursor() as cursor:
|
with self.get_event_cursor() as cursor:
|
||||||
for data in cursor:
|
for key, data in cursor:
|
||||||
yield data[0]
|
yield key
|
||||||
|
|
||||||
def get_family_handles(self):
|
def get_family_handles(self):
|
||||||
"""
|
"""
|
||||||
@ -1476,8 +1476,8 @@ class GrampsDbBase(Callback):
|
|||||||
Return an iterator over handles for Families in the database
|
Return an iterator over handles for Families in the database
|
||||||
"""
|
"""
|
||||||
with self.get_family_cursor() as cursor:
|
with self.get_family_cursor() as cursor:
|
||||||
for data in cursor:
|
for key, data in cursor:
|
||||||
yield data[0]
|
yield key
|
||||||
|
|
||||||
def get_repository_handles(self):
|
def get_repository_handles(self):
|
||||||
"""
|
"""
|
||||||
@ -1493,8 +1493,8 @@ class GrampsDbBase(Callback):
|
|||||||
Return an iterator over handles for Repositories in the database
|
Return an iterator over handles for Repositories in the database
|
||||||
"""
|
"""
|
||||||
with self.get_repository_cursor() as cursor:
|
with self.get_repository_cursor() as cursor:
|
||||||
for data in cursor:
|
for key, data in cursor:
|
||||||
yield data[0]
|
yield key
|
||||||
|
|
||||||
def get_note_handles(self):
|
def get_note_handles(self):
|
||||||
"""
|
"""
|
||||||
@ -1510,8 +1510,8 @@ class GrampsDbBase(Callback):
|
|||||||
Return an iterator over handles for Notes in the database
|
Return an iterator over handles for Notes in the database
|
||||||
"""
|
"""
|
||||||
with self.get_note_cursor() as cursor:
|
with self.get_note_cursor() as cursor:
|
||||||
for data in cursor:
|
for key, data in cursor:
|
||||||
yield data[0]
|
yield key
|
||||||
|
|
||||||
def get_gramps_ids(self, obj_key):
|
def get_gramps_ids(self, obj_key):
|
||||||
key2table = {
|
key2table = {
|
||||||
|
Loading…
Reference in New Issue
Block a user