4284: Common ancestor filter ignores persons without ancestors
svn: r17166
This commit is contained in:
parent
3fd1205fbc
commit
f97eca7f33
@ -66,6 +66,11 @@ class HasCommonAncestorWith(Rule):
|
|||||||
def add_ancs(self, db, person):
|
def add_ancs(self, db, person):
|
||||||
if person and person.handle not in self.ancestor_cache:
|
if person and person.handle not in self.ancestor_cache:
|
||||||
self.ancestor_cache[person.handle] = set()
|
self.ancestor_cache[person.handle] = set()
|
||||||
|
# We are going to compare ancestors of one person with that of
|
||||||
|
# another person; if that other person is an ancestor and itself
|
||||||
|
# has no ancestors is must be included, this is achieved by the
|
||||||
|
# little trick of making a person his own ancestor.
|
||||||
|
self.ancestor_cache[person.handle].add(person.handle)
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -78,7 +83,6 @@ class HasCommonAncestorWith(Rule):
|
|||||||
if par and par.handle not in self.ancestor_cache:
|
if par and par.handle not in self.ancestor_cache:
|
||||||
self.add_ancs(db, par)
|
self.add_ancs(db, par)
|
||||||
if par:
|
if par:
|
||||||
self.ancestor_cache[person.handle].add(par)
|
|
||||||
self.ancestor_cache[person.handle] |= self.ancestor_cache[par.handle]
|
self.ancestor_cache[person.handle] |= self.ancestor_cache[par.handle]
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user