Implement iter_people_handles methods and begin to use them - second batch of updates

svn: r12774
This commit is contained in:
Gerald Britton 2009-07-07 18:58:47 +00:00
parent 7a235029d8
commit 2769b58a44
10 changed files with 11 additions and 14 deletions

View File

@ -236,7 +236,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
def get_all_handles(self):
if self.namespace == 'Person':
return self.db.get_person_handles(sort_handles=False)
return self.db.iter_person_handles()
elif self.namespace == 'Family':
return self.db.get_family_handles()
elif self.namespace == 'Event':

View File

@ -59,7 +59,7 @@ class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith,MatchesFilter):
filt = MatchesFilter(self.list)
filt.prepare(db)
def init(self, h): self.ancestor_cache[h] = 1
for handle in db.get_person_handles(sort_handles=False):
for handle in db.iter_person_handles(sort_handles=False):
if (handle not in self.ancestor_cache
and filt.apply (db, db.get_person_from_handle(handle))):
for_each_ancestor(db,[handle],init,self)

View File

@ -67,7 +67,7 @@ class IsAncestorOfFilterMatch(IsAncestorOf,MatchesFilter):
filt = MatchesFilter(self.list[0:1])
filt.prepare(db)
for person_handle in db.get_person_handles(sort_handles=False):
for person_handle in db.iter_person_handles(sort_handles=False):
person = db.get_person_from_handle( person_handle)
if filt.apply (db, person):
self.init_ancestor_list (db,person,first)

View File

@ -53,7 +53,7 @@ class IsChildOfFilterMatch(MatchesFilter):
self.map = {}
filt = MatchesFilter(self.list)
filt.prepare(db)
for person_handle in db.get_person_handles(sort_handles=False):
for person_handle in db.iter_person_handles(sort_handles=False):
person = db.get_person_from_handle( person_handle)
if filt.apply (db, person):
self.init_list (person)

View File

@ -67,7 +67,7 @@ class IsDescendantOfFilterMatch(IsDescendantOf,MatchesFilter):
filt = MatchesFilter(self.list[0:1])
filt.prepare(db)
for person_handle in db.get_person_handles(sort_handles=False):
for person_handle in db.iter_person_handles(sort_handles=False):
person = db.get_person_from_handle( person_handle)
if filt.apply (db, person):
self.init_list (person,first)

View File

@ -53,7 +53,7 @@ class IsParentOfFilterMatch(MatchesFilter):
self.map = {}
filt = MatchesFilter(self.list)
filt.prepare(db)
for person_handle in db.get_person_handles(sort_handles=False):
for person_handle in db.iter_person_handles(sort_handles=False):
person = db.get_person_from_handle(person_handle)
if filt.apply (db, person):
self.init_list (person)

View File

@ -52,7 +52,7 @@ class IsSiblingOfFilterMatch(MatchesFilter):
self.map = {}
filt = MatchesFilter(self.list)
filt.prepare(db)
for person_handle in db.get_person_handles(sort_handles=False):
for person_handle in db.iter_person_handles():
person = db.get_person_from_handle( person_handle)
if filt.apply (db, person):
self.init_list (person)

View File

@ -193,11 +193,8 @@ class GenericFilter(object):
return count == 1
def or_test(self, db, person):
for rule in self.flist:
if rule.apply(db, person):
return True
return False
return any(rule.apply(db, person) for rule in self.flist)
def get_check_func(self):
try:
m = getattr(self, 'check_' + self.logical_op)

View File

@ -161,7 +161,7 @@ class MergePlaces(ManagedWindow.ManagedWindow):
# replace references in other objetcs
# people
for handle in self.db.get_person_handles(sort_handles=False):
for handle in self.db.iter_person_handles():
person = self.db.get_person_from_handle(handle)
if person.has_handle_reference('Place',self.old_handle):
person.replace_handle_reference('Place',

View File

@ -165,7 +165,7 @@ class MergeSources(ManagedWindow.ManagedWindow):
# replace handles
# people
for handle in self.db.get_person_handles(sort_handles=False):
for handle in self.db.iter_person_handles():
person = self.db.get_person_from_handle(handle)
if person.has_source_reference(self.old_handle):
person.replace_source_references(self.old_handle,